Error in <TSelectorDraw::Begin>

I’ve encountered the following problem:
I open a file, read a tree out of it (tree = (TTree *) gROOT->FindObject(“h1000”)). In a function I create a histogram *hist(“Muon2”, …). I project some data off the tree unto the histogram and close the hist. Outside of the function I close the file, then open a new one and repeat the process. However, the second time I get this:

Error in TSelectorDraw::Begin: An object of type ‘TH1F’ has the same name as the requested event list (Muon2)

Why is that and how do I fix it?

Looks like you are making a mistake in your TTree::Draw command,
filling an event list instead of a histogram.
Please read the doc of TTree::Draw