Destroy the channel.
If the channel is open.
If there is data to read, non blocking.
Read at most s bytes from the channel.
ditto Destroy the channel.
Writes as much data as possible to the output.
Flush the output.
Destroy the channel.
Close the write channel.