misplaced sqlite3_finalize