Fix close_stream