Handle deletion of files during cache shrinkage.

Fixes #557.