Hi,
I'm assuming that your using Windows Operating system, Firstly you need to go into the control panel and click system & security. After that you need to click the power options, then on the left hand side it should give you a list to select from, you want to click choose what closing the lid does.
then change the settings as your desire then you laptop should stay running when you close the lid.
Remember to change the settings back to save your battery.
Hope this Helps.