- close the socket if connected