Fixed an annoying nullpointer operation
Fixed so that we have a two-stage commit of the cache files. First we move the file from the temp folder to the cache folder under a name ending in _new. Then we delete the file in cache and move the _new file to the correct name.

If, for some reason, we later on request a file that is not found in cache, but where the _new file exist, we move the _new file to the correct name and returns the file.