If the socket throws the connection.socket will be undefined.  Therefore we'll try and call close on an undefined socket which would throw again.