When I close my laptop it suspends as expected, however it does not lock the screen before going to sleep. As a result, when I open the laptop (and thus waking up the laptop) I can see all open applications. Then within a second or three, the instruction to lock gets triggered and only then I am shown the lock screen. When I suspend the laptop by using the power menu (so not closing the lid) the screen is locked correctly before suspension.

I don't know how to troubleshoot this issue: where should I start to resolve the issue?

I am running Elementary 5.1, but this issue showed in older versions as well. My laptop is an Acer C720.