saving stats in a file