write all the histos into files