FIX: Cursor leak

Cursor leaks would cause the cursor resource to be exhausted when
importing a large account tree with a lot of transactions.