Problems getting full shutdown when lid is closed (debian 12 kde)

Hi, I am trying to have the laptop shut down when the lid is closed.

I noticed that it never fully shuts down, but is in a weird state where the mouse is still movable and the taskbar is still rendered. It will stay in this state until I press the power button, after which it immediately shuts down.

I tested to see if something was blocking the shutdown by changing the ‘suspend session’ setting to ‘shutdown after 1 min’. This complete successfully.

It seems closing the screen is interrupting the shutdown sequence. I can sleep, lock, and turn off screen, but shutdown just wont go.
Any ideas of a workaround?
Thank you.

Got it to work by setting HandleLidSwitch=ignore in /etc/systemd/logind.conf. Turns out default behavior was causing it to suspend during the shutdown process.