temporary fix for thread leak when sparqlQuery is null
make sure CachingService is closed in case of an exception