I currently have my MBP M1 connected via the USB-C input on my LG 27" 4K monitor and I frequently switch to HDMI connection for my work Win machine. Every time I switch back to the Mac its asleep when the display is closed. I have it set to "prevent computer from sleeping when display is off."