Although hedit of IRAF is supposed to handle the keywords of a fits file (add, remove) its behaviour can be misleading sometimes. An error like this:
ERROR (1121, “FXF: EOF encountered while reading FITS file (something.fits)”)
means that after altering the keywords in the header the EOF of the header has been placed wrongly. The solution is to place some dummy keywords more… but it seems to be an insisting bug.