Fix the confirmation dialog when closing the tab

* Only nag if we're connected
* Set event return value so Chrome shows the dialog