Write correct number of columns for investment transactions to csv file
Cherry-picked from 3a89db9fac1294a1bc3cfe09551caeef40572bde and adjusted to master