first implementation of InsertWithCursor
clean up
implement InsertWithCursor for unopened files