Force writing TFile

Is it possible to force the creation of a TFile as soon as it is open?

I am using the option “RECREATE”. I notice that the file is not actually written but only until the automatic tree::Write operation is called, when the tree is being filled. Is there a proper way to do this, as to force the creation of the file?

Would [quote]TFile::Flush()[/quote] work for my purpose?

Or doing something like

file = new TFile("myfile.root","RECREATE");
dataTree = new TTree(kTTreeName.c_str(),"Tree containing G4 simulation results");
dataTree->Write(); //or file->Write(); //even if I haven't started saving anything yet?

Thank you,