Cancels reception of remaining elements from this channel with an optional cause. This function closes the channel and removes all buffered sent elements from it.
A cause can be used to specify an error message or to provide other details on the cancellation reason for debugging purposes. If the cause is not specified, then an instance of CancellationException with a default message is created to close the channel.
Immediately after invocation of this function isClosedForReceive and isClosedForSend on the side of SendChannel start returning
true. Any attempt to send to or receive from this channel will lead to a CancellationException.