throw connection_reset error is stream is closed