Discord and Anytype displaying errors if I close my screen

I'm not really sure what may be causing this, maybe the package format used to install them. For Discord, for example, you can install it either from the Software store as a so-called "Flatpak" or download it from their website directly and install it as "Debian package".

Don't worry about what these are right now, they are just different ways to do the same things, although with some nuances. It may not be related at all, but I think it's worth trying installing Discord, as a test, from their website.

Here is another thread with some instructions, and extra context: