2103: Fix issue 2102 (bug introduced in 2098) r=mergify[bot] a=Diman0
## What type of PR?
Bug-fix
## What does this PR do?
The changes to session management introduced in #2094#2098 introduced new bugs. This PR addresses these.
### Related issue(s)
- Auto close an issue like: closes#2102
## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.
- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.
Co-authored-by: Dimitri Huisman <diman@huisman.xyz>