write statistics to files