Avoid duplicate error message when server closes the connection