Lock after 3 mins of closed screen inactivity?

i would like to make my laptop so that after 3 mins after i close my laptop and don't re-open it in 3 minutes, it would automatically lock the account

i thought of task scheduler, but before that,  ran into a trouble, what does windows call the situation of closing the lid? i need to know that name in order to make that batch file ( at least trying to, don't think it's gonna work...)

I believe you can only tell it to lock after Immediately after closing the lid but someone else might have a solution, that's just my experience