Fix csv read/write off by one

There was an off by one error in read_csv because of a trailing comma in write_csv. This should fix that.
Tests still pass after this change