Fixed race conditions in FilesystemCache

In our environment (presumably because of the NFS) under high load after deployment, a lot of E_WARNINGs are emitted  because of race condition in mkdir() used in the FileSystemCache::save.

Fortunately I've seen a very good solution for this problem in the Twig library: https://github.com/fabpot/Twig/blob/master/lib/Twig/Environment.php :: writeCacheFile

I have copied and slightly adapted the cache write routine from Twig library. Hopefully it is allowed, with proper appreciation.
`https://github.com/fabpot/Twig/blob/21f0b82/lib/Twig/Environment.php` is probably a better ref (got it by pressing the 'y' key on GH & reducing the sha1 to 7 chars)