Closed a cursor to fix a potentially nasty problem that throws exceptions