fix crash issues: exceptions will be thrown on closed sockets when trying to close again or get local/remote endpoints
format socket.h