close the socket and return -1 if the socket `connect` call fails