Added the cursor.close() that got  left behind in the previous commit