FITS: correct for truncated files

Fixes #10234.