Add a close method to Resolver and use it where necessary.

This fixes a thread leak when running the test suite with
ThreadedResolver.