Write output to a file if given

Portfolio collects the statistics and outputs them
in csv format.