1.Press "Windows+R" and type "powercfg.cpl".
2. Hit enter and click on "Choose what closing the lid does"
3. Now click on the dropdown menu corresponding to "When I close the lid" and choose whatever function you want your PC to perform on closing the lid. Say, Shut Down
4. Set desired settings and click on the "Save Changes" button at the bottom. That's it, you're done.