check the return value of `fwrite`
Merge pull request #2460 from cremno/mrb_dump_irep_binary-report-fwrite-failure

check the return value of `fwrite`