Secondary display turns off when I close the flap of my MacBook pro running on High Sierra
The mac has to be plugged in for it to still work with the lid closed.
If you have a USB-C power port, you may have to unplug the cord from both the MacBook and the brick, and then plug it in again. Sometimes it comes loose on one of the ends