Fix bug: close socket in connected_sock when connect failed