Fixup cursor handling of EOF.

Add invariants checking for usage of saved cursors.