fix stream not closed.