Merge "Fix race in CommitCodeInternal and cleanup"