Split TTree across multiple files

Hi,

I have to read large quantities of data, and I would like my programme to fill a tree with a fixed number of events, then close the current TFile and open a new one.

How can I reset the tree and set it to the new location without risking a crash?

Matteo