Close the session for preview generation

Without closing the session every preview image generation is locking the session which makes the webinterface unresponsive.
Merge pull request #11352 from owncloud/close-session-for-previews

Close the session for preview generation