It didn't crash. I got the following line in the terminal window:

Invalid argument
WARNING: 319 NaNs found in subjid.map.mgh

When the NaNs were common in all the subjects, mri_glmfit did not end successfully. After I omitted the common NaN values, there were still a few subjects with NaN values, in this case, it printed the above lines in the terminal; but the mri_glmfit proceeded and sig.mgh was created alongside other outputs.