Lately everytime I open a window and surfing, few seconds later advertising coming out on a new tab. It is very annoying that I have close them every single time. Does anyone know how to stop it?

This works for many folks (but not all; depends on your systems configurations & severity of malware infection) and helps prevent hijackings, etc.:
When PC's (personal confusers) misbehave, one step to help reduce annoying pop-ups & unrequested websites from being displayed on your machine is to turn off 3rd party cookies, and always leave them off.
These are general settings:
INTERNET EXPLORER: Tools> Internet Options> Privacy> Advanced:
here check 'Override automatic….'; 'Allow session cookies'; 'Allow 1st party cookies' & 'Block 3rd Party Cookies'.

FIREFOX: Tools> Options> Privacy: Check 'Accept Cookies from sites'
& Un-Check 'Accept 3rd Party cookies'

For nearly ad-free pages when surfing; use Firefox with these add-ons:
Flashblock: https://addons.mozilla.org/en-US/firefox/addon/433
Add block plus: https://addons.mozilla.org/en-US/firefox/addon/1865

Because architecture of the Internet (notably 'Flash' scripting), vulnerabilities are readily exploited in Internet Explorer, & it is now > urgent < that you
use Firefox with 'NoScript' add-on, which will prevent "Click-jacking'.
NoScript: https://addons.mozilla.org/en-US/firefox/addon/722

Note: You must remove all malware currently on your system, with trusted cleaners, as some current 'rouge' malware will undo this change.