Fix for not clearing temporary files correctly when generating cached files.