fixes #3 piwik/piwik#6873 write cache file in an atomic way if possible