Resolving double opening of hdf5 file.