Add NextIterator.closeIfNeeded.