I use the EEPROM Address in my commands. For example, "READ 0, Duty" and "WRITE 0, Duty". Writing to the EEPROM takes an eternity in computer time.

Another method might be to use a rather large capacitor for the PIC power supply so that it takes a couple hundred milliseconds for it to drop below threshold Vdd voltage. Use an input to monitor when the main switch is turned off. Write to the EEPROM only when the main switch powers down. EEPROMs have a limited number of writes, usually rated around 100,000 times. If you are writing to the EEPROM every time your value changes, you could be using up those 100,000 Writes in a relatively short product lifetime. I use a 2200 uF cap in one of my projects to ballast noise. There is sufficient Vdd for over a second after I power down, ample time to write to the EEPROM.