Edited fits IO to get first valid HDU