only call iod_fini() if there was not an earlier error