Fix an use-after-statement-closed error with USING PERIODIC COMMIT