Hi Quentin,
It might be a problem deleting the histograms at the end of your program. Can you add either the following line before the loop:
ROOT.TH1.AddDirectory(False)
or, alternatively, right after reading every histogram:
hist.SetDirectory(0)
For reference (“Creating histograms” section):
https://root.cern.ch/doc/master/classTH1.html