fix ignoring return value of ‘fwrite’

declared with attribute warn_unused_result.
return now NIL on fwrite errors with the print methods.
detected with centos