My MacBook Air often tries to log me out when I close the lid
Often when I open my MacBook Air (original M1 with MacOS 12.3.1) and log in after having closed the lid on whatever I was doing or after putting it to sleep from the Apple menu, I get a message saying that log-out was prevented by some app, such as Facebook Messenger or Terminal. I hardly ever log out before closing the lid.
This seems to happen whether it's plugged into the charger or not. I never leave peripherals connected when I close the lid or select "Sleep" from the Apple menu, because the hub alone seems to drain the battery extremely fast. Maybe I should also mention that the MacBook sometimes has a completely drained battery after just 3–4 days. Could these issues be connected?
There are times when it doesn't try to log me out, but I haven't figured out why that happens anymore than I can understand why it happens so often.
It's possible that these issues have been there from the day I bought the MacBook Air: I didn't use it much at first, and then I thought the whole problem was with the hub, and then another hub, and then I didn't use it much again for a while. But now it's clear that there's a problem.
MacBook Air 13″, macOS 12.3