One way to end the cycle may be to use keyboard shortcuts (like Alt+F4 in Windows) instead of the mouse to close the windows. Multiple windows can be closed quickly with this method, although it may not always work if there is a resident program which is opening them. Browser extensions which disable scripting for all but a trusted whitelist of sites, such as NoScript Security Suite, can be a useful defence against mousetrapping and malicious sites.