Fix the confirmation dialog when closing the tab

* Only nag if we're connected
* Set event return value so Chrome shows the dialog
Merge pull request #165 from lorenzhs/fixnag

Fix the confirmation dialog when closing the tab