By default, Windows may put your laptop to sleep when you close the lid.
If you use your laptop with an external monitor, keyboard and mouse, you may want it to stay on when the lid is closed.
Open the Control Panel and go to:
Hardware and Sound > Power Options
On the left-hand side, click:
Choose what closing the lid does
Under When I close the lid, change the setting to:
Do nothing
You can choose separate settings for:
On battery
and:
Plugged in
For example, you may want the laptop to sleep when running on battery but stay on when connected to power.
Click:
Save changes
Your laptop should now remain running when you close the lid.
Important
Make sure the laptop has adequate ventilation when used with the lid closed.
Some laptops draw air through the keyboard or surrounding vents, so closing the lid may affect cooling.