These are super annoying in Safari, too. Apple needs to take note and follow Firefox’s lead here.
I disabled them and never see them anymore.
Safari's implementation could also be improved. The modal forces you to chose without the ability to cancel, and saves the website into your preferences, even if you just want to immediately close the tab.