I closed my Lenovo laptop by just shutting the lid and went out for about 30 minutes. When I returned and plugged in a desk lamp to the USB, I opened the laptop's lid. It showed the lock screen for a few seconds, but then, without any input from me, it just shut down. This hasn't happened to me before, at least not that I remember. I'm using Windows 11.
2 Answers
If you're interested, there might be a way to check what caused it. You can look at the Event Viewer on your laptop to see if there are any error messages or logs that indicate what happened around the time it shut down.
It sounds like your laptop was trying to hibernate when you closed the lid, but something might have interrupted that process. When you opened it again, it finally cleared whatever was blocking it and then just shut off, which isn't typically how it's supposed to work.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures