Finished all calculations, writing to text file