Ensure that all cursors are closed properly
Merge pull request #378 from benmccann/cursor-close

Ensure that all cursors are closed properly