Cursors are now properly closed when they are done being used.