moved creation and writing of output phylogeny until after the writing of all.populations, time.richness and end.params so that if the phylo bonks, at least the other output will be saved first