writeLongString(): handle unability to write as an error