stream: handle end of stream.