Output statistics to file.