Fixed a problem in socket_connect_addr where the call to
connect fails permenantly and we close the socket but continue
to loop with a bad socket handle.