Handle I/O errors while writing the cache file