Replace Iterable with Sequence in CursorFactory

Ensures cleaner closing of resources