Added fix to ensure all HDF5 groups are closed if opened when string ndattributes are written.