make sure channel is not closed while still reading from stream