Closes this channel with an optional exceptional cause.
This is an idempotent operation – repeated invocations of this function have no effect and return
Conceptually, its sends a special “close token” over this channel.
Immediately after invocation of this function
isClosedForSend starts returning
true. However, isClosedForReceive
on the side of ReceiveChannel starts returning
true only after all previously sent elements
A channel that was closed without a cause throws ClosedSendChannelException on attempts to send or receive. A channel that was closed with non-null cause is called a failed channel. Attempts to send or receive on a failed channel throw the specified cause exception.