Don't overwrite cache timestamp until after build has been compiled and saved.

I am using asset compress build_ini task on our live server in our deploy script, but was having problems because the build timestamp cache file was being overwritten before the compiled file was generated, which caused visitors to get 404 errors when visiting the site, which were then cached on our CDN causing problems for everyone.
Why does the file name need to change while the file is being built?