fix stream close error