The subfolders also need the owner flag setting.
@Frederik_Wauters, can you add these lines to the end of your process_file
function?
histos_folder.SetOwner(True)
for fo in histos_folder.GetListOfFolders():
fo.SetOwner(True)
histos_folder.Clear()
Cheers,
Enric