Change what happens when you close your laptop
When you close your laptop lid, Windows can shut down, do nothing, or enter a power-saving state, such as sleep or hibernation. You can apply the same setting to all of your power plans or you can apply different settings to individual plans.
...
To apply a setting to a specific plan
Open Power Options by clicking the Start button, clicking Control Panel, clicking System and Security, and then clicking Power Options.
On the Select a power plan page, click Change plan settings for the plan that you want to change.
On the Change settings for the plan page, click Change advanced power settings.
On the Advanced settings tab, expand Power buttons and lid, expand Lid close action, choose what you want your laptop to do when you close the lid, both for when it's running on battery and when it's plugged in, and then click OK.