I would like to clarify that this would not be a driver issue, but would have to do with a setting set in the windows power options.
I tried to replicate this with a laptop using both Intel Graphics and Nvidea* GPU, but I got the same behavior with either one. It seems that even though you can choose the option to “do nothing” in the “when I close the lid” tab under power options, the lid still actually turns the display off without the system actually being affected, then windows sets whatever display is still connected as default, I suspect that this is what it is designed to do under these circumstances.
I was looking through Microsoft forums and I found this link:
You can try the suggestions from the Microsoft forums to see if there is anything that may help you and we can also wait for other users to share any experience they have had regard this configuration and to see if they have any other suggestions.