Only write stats file on changes