Hey ArjanSchep,
There could be a few reasons for this. One item to check is the current configuration of the settings for what to do when your computer is inactive for a time. For example, there is a setting in System Settings that will log your user out if there is a specified period of inactivity, and this could, based on other settings, close certain aspects of your system. Start by going to the Apple menu > System Settings, then click Privacy & Security in the sidebar. Click Advanced a the bottom and see if “Log out automatically after inactivity” is turned on. If it is, you might consider turning that off.
If you'd prefer to keep that setting turned on, something else to check might be your Login Items, which determines what apps and functions open when logging into your user account. That is covered in more detail in Open items automatically when you log in on Mac.
You can also Set sleep and wake settings for your Mac which will give you more control over how things are handled during periods of rest with your Mac.
Take care.