Avoid to close the already closed socket.