Fix a bug when create a TCP client thread

If TCP client socket cannot be created, close this socket fd.