Close session for search

Make search non-blocking.
Merge pull request #11831 from owncloud/make-search-non-blocking

Close session for search