Fixes issue converting float to decimals

  * This would cause a wrong conversion to numeric type without scale
Fixes bug calculating field length

  * the loop was keeping the length of the last matching field
Fixes bug writing last column when empty

  * To write to the file we need to add an extra tab at the end
    otherwise postgres thinks the data is missing