ENH: Make the checks for valid nifti files more robust.