OTA hook before restart?

I am trying to call code after my ESP32 device received a FW update via OTA, but before the device is reset. This is because I want to make sure files are closed, and the hardware is in state where it will come up reliably.

Is there a hook, or an event, or some way to execute my own code before OTA restarts my device?

Thanks…