Fix caching of 0-byte files

For some reason there was a check to see that the destination for the
cached file exists before writing an empty file. This prevented a 0-byte
file from overwriting a previously non-empty file in the cachedir. This
commit removes that check for the cache file's existence, allowing it to
be overwritten.

Fixes #6200.