NoScript mostly solves this, except for sites that open up with the pop-ups already visible and require JavaScript to be enabled to be able to close them. My reaction then is usually to just click the back-button.