fix file store by adding an atomic write and rescuing failures

In our Rails applications we were getting ```ActionView::Template::Error: end of file reached``` sporadically, similar to https://github.com/sstephenson/sprockets/pull/441. We were getting that error specially when we were running the specs using parallel specs.

Debugging (cc @fabiokr) we discovered that it was probably due to a race condition in file_store where it tries to read the cache file after the cache file have been created but its content haven't been entirely dumped and the file closed. 

This changes seem to have fixed it.

Basically it does an atomic write that prevents that race condition.

Any thoughts? @sstephenson @josh