Make NameResolver implement Closeable, so that it works with try-with-resources