Windows has special power management settings that control what happens when the laptop lid is closed. If this happening, these settings need to be changed. Please right-click on the Start button and select ‘Power Options’ from the menu.
From the choices present on the left-hand side of the Power Options window, please click on ‘Choose what closing the lid does’.
Important note – if you are running the Creators Update (or newer) to Windows 10, you will have click on the ‘Additional power settings’ option to access this window .
Make sure the setting for ‘When I close the lid’ under the ‘Plugged In’ column is set to ‘Do Nothing’. Click the ‘Save Changes’ button and restart the system, making sure that the laptop’s power adapter is also connected, and test the behavior again.