It's not a good to move cursor.close() out of finally.