the stream should be closed