Only write build file times to cache after the build is complete.

I was having problems with the build timestamp cache being overwritten before the build was completed. This caused problems when building on the live site as it could take a few seconds to build which made my CDN cache the 404 error page.