[TargetIntegrator] Ensure the project is saved when needed

Addresses a regression introduced in https://github.com/CocoaPods/CocoaPods/pull/2601