Turn off sleep mode when closing the lid. Go to your Control Panel and navigate to Power Options. On the sidebar, select "Change what happens when you close your laptop's lid." Set the dropdown box to "Do nothing."
Also, depending on what OS you are running, sleep mode and hibernate may not be functioning correctly due to outdated drivers. Try updating your graphics card drivers to the latest version, if you want to keep the sleep function.