Give TripleStore a chance to optimize any iterator.

TripleStore gets to go second just in case there are "obvious"
optimizations that can be done outside of the backend.

Also make sure to close any discarded iterators.