Here's a [https://pureinfotech.com/enable-disable-signin-again-windows-11/|link] that shows how to enable password requirement when waking from sleep mode if this is what you meant by closing the PC i.e. closing the lid, PC goes into sleep mode.
+
+
You can also press the Win key + L key if it is not sleep mode.