better handling of BROKEN_PIPE error (error 32, client closed connection)