'runClientWith' correctly closes socket in timeout case

Previously this function would leak socket handles if the call to
connect failed (i.e. timed out). It seems that sockets must be closed
whether they are successfully connected or not.