fix stream close.