Writing to HDF5 file