Cleaning upon firefox shutdown

I'm sure this has been discussed before, but i couldn't seem to find anything specific. I was wondering if there was a way to configure ccleaner to automatically run upon shutdown of firefox. Just firefox, and not shut down the pc, but just when i close all firefox windows if ccleaner could run.

Thanks! :)

Bad thing to do.

If termination of Firefox launched Ccleaner so the Firefox cache was cleaned,

after a Firefox crash how would it be able to restore your pre-crash tabs ?

Much better to have a shortcut to a batch script that :-

closes Firefox;

waits for FireFox.exe process to terminate;

Launches CCleaner.

Alan