Check duplicate issues.
Description
When converting to cmake, find out that macro fails.
Problem when after opening and closing created treeobj.root file extra branch.root file left opened.
Therefore getting extra output compared to ref file.
Reproducer
Just run macro to see that extra output with "Some files where not closed" appeared.
ROOT version
master on Windows
Installation method
build from source
Operating system
Win 64bit
Additional context
Recognized by testing in #19516