Check end iterator in tree_iterator