Commit at the end of the loop