Prevent a tab from popping up dialogs when closing the tab

Prevent a tab from popping up dialogs when closing the tab. Copied from UserScripts.org

Scripts posted on Greasy Fork must abide by its rules. Report violations using the links below and Greasy Fork moderators will review your report.

Please note that being non-functional and contravening a third party's terms of use are not violations of Greasy Fork's rules. In these cases, you can instead leave feedback on the script.