Close Cursor in queries