Google sheets script order not executing properly

I have a spreadsheet that loads a customer’s saved checkout sheet. When the function is called it loads a snapshot of the customer’s checkout sheet the last time it was saved. After the snapshot is loaded there are 3 fields that need to be altered to set the proper day and time of the new checkout.

I’ve tried writing the code where these three fields are at the end of the function, where they are a function by themselves that gets called at the end of the original function, and have tried using a Utilities.sleep(), all which do not work. What ends up happening for all these scenarios is the three cells will change to their expected values for a split second, and then revert to the values that were loaded from a customer’s saved sheet.

I don’t understand who this is happening, as these 3 cells are being altered only after the previous code has completed. Help please!

  function loadSnapshot(){

//Gets checkout sheet ID from Customer's profile  
  try {
  let artistName = SpreadsheetApp.getActiveSpreadsheet().getRange('Signature Sheet!F6:F6').getValue()
  let customerCheckoutSheetID = DriveApp
  .searchFiles(`title contains "${artistName} + Saved Checkout Sheet"`).next().getId();
  
  
  let customerSheetLR = SpreadsheetApp.openById(customerCheckoutSheetID).getSheets()[0].getLastRow()
  let customerSheetLC = SpreadsheetApp.openById(customerCheckoutSheetID).getSheets()[0].getLastColumn()

  let customersSheetValues = SpreadsheetApp.openById(customerCheckoutSheetID).getSheets()[0].getSheetValues(1,1,customerSheetLR,customerSheetLC)

  let mainSheetActiveRange = SpreadsheetApp.openById('xxx').getSheets()[0].getRange('Signature Sheet!A1:H41')
  let mainSpreadsheetValues = SpreadsheetApp.openById('xxx')
  .getSheets()[0].setActiveRange(mainSheetActiveRange).setValues(customersSheetValues)
  
  headerFields()
  
  }
catch(error){
  SpreadsheetApp.getUi().alert('No Saved Snapshot')
 }
}

function headerFields(){
//Header Formulas
  var spreadsheet = SpreadsheetApp.getActive()
  let checkoutTime = spreadsheet.getRange('Signature Sheet!F9:F9').setFormula('=now()')
  let hoursUsed = spreadsheet.getRange('Signature Sheet!F10:F10').setValue('')
  let timeFormula = spreadsheet.getRange('Signature Sheet!F11:F11').setFormula('=NOW()+TIME(F10,0,0)')

}