add new line at end of file when OptimResult writes x.