more iterator optimization

Iterators now don't open a db transaction until the first call to
Next(), and automatically close the db transaction when the last result
is observed.

Additional, Node iterators will cache their values if below a minimal
size threshold.

NB Tags are not properly propagated in OptimizeIterator