Depends on the municipality. Some will let you"assume" the violations and close without the CO, others will insist on the repairs being complete. This has been rare, in my experience. Some towns do not inspect except for the fire detector (State law, they must.)
Those that allow assuption will not allow occupancy before the CO and will set limits on the time you take to remediate the defects.
I have seen closings where there was a mortgage with funds transfered and no CO. Perhaps Mr. Bain has not found companies willing to do so.