Write hdf5 file