Correct errors in write_csv().

The number of fields being written in the data rows did not match that in the
header row.  'subroutine' and 'total' were not being written out.  The second
field in each data row was superfluous.

Correct misspellings in names of fields.