Fix a memory leak with cached replicas
Remove files from cache if they no longer are Unused in the
transformation