Need to force close suspicious tab/dialogue box jamming everything
That box is clearly trying to install some funny trojan on your computer. (side advice: never download Flash from anywhere that's not Adobe's website, but I'm sure you already know that if you're 'sailing the high seas'.)

Unfortunately, there's no way to avoid closing everything. The only way out of this is to force-quit Safari through Force Quit - the keystroke 'Option-Command-Escape (⌥⌘⎋)'. This would bring the Force Quit menu into focus, allowing you to close Safari and ultimately the problematic tab. The good thing about Force Quit is that it always stays on top and in focus, so the tab shouldn't be able to steal focus from the menu.



The Force Quit menu. As you can see, the current open application is highlighted automatically.

If Safari tries to reopen the closed tabs, ⌥⌘⎋ it again. The next time it starts, it shouldn't try to reopen the closed tabs.

It's probably a good idea to track down which site/tab caused this dialog to show up and either inform the webmaster or avoid visiting the site for a few weeks for your safety. Additionally, you may want to disable auto-opening of "safe" files by Safari.