write out file per positions, fixes nulls and nans