Close socket at end of connection