I think you are looking for .close ()
f.close()
Although I look closer, I'm not sure why contextlib.closing (...) is not working.
I edited the line involving contextlib:
with contextlib.closing(h5py.File(filename, fapl=propfaid)) as fid:
and deleted
f = h5py.File(fid)
Subsequently, I could verify that the feed was closed and that the rename file was working as expected.
print fid <Closed HDF5 file> os.rename(filename, 'foo2.hdf5')
No errors and directory check shows new name
source share