change the order of deleting files