If the openUpdateImage() routine is used the file designated by the filename must already exist. The HDU number associated with extname and extver is read and then re-written.
The openUpdateImage() routine automatically reads the header associated with the image. You do not have to do a separate getHeader().