Make sure we always set $connected to false, even when we get an exception when we are sending quit()