Prevent screen turning off when lid is closed
Go to gpedit.msc
and setting the Select the lid switch action options for both "on battery" and "plugged in" to "Enabled" and then restart the PC.
Navigate via gpedit.msc
| Computer Configuration
| Administrative Templates
| System
| Power Management
| Button Settings
| set both the "Select the lid switch action" options to Enabled
. Be sure to set the Lid switch action to a value of Take no action as well.
Be sure to fully power cycle and reboot the machine once you apply these settings
Replacing the ACPI Lid device's driver as described in this answer is the only thing that has ever solved this problem for me. It's so worth the drawbacks if you're using external displays, being able to close and open the lid without fullscreen apps crashing (e.g. old games) or messing up all the windows that you've carefully laid out on multiple monitors.