Fixing a resource leak due to HDF5 groups not being closed before the file was closed.