Plenty of these in the code. Anytime there's a need to close/stop a resource, it should be done in a finally section.

If you wanna avoid littering your code with try/finally sections, you can do something similar to what `TestingUtil.withCacheManager` does applied to Directory instances, i.e. `TestingUtil.withDirectory`