Properly test linking of files.

Previously this code would try to clean up files that didn't necessarily exist, causing the cacher to blow up. I've tested this locally and it should work properly, provided you can unlink a file right after creating it.