Close session only if encryption app is not enabled

Fixes https://github.com/owncloud/core/issues/12389