Ensure ResourceIterator is properly closed.