Only emit the first error before closing the socket.