When you close the lid, the laptop goes into sleep mode by default. The purpose of sleep mode is in order to save power by not running programs.
You can tell your laptop to not sleep when you close the lid, though.
http://windows.microsoft.com/en-us/w...se-your-laptop