Save after setting histogram bin

Hello all, this one should be pretty basic.
I can’t seem to get a histogram change to stick:

root [0] TFile *_file0 = TFile::Open("file.root")
(TFile *) 0x408e8d0
root [1] hJetPT->GetBinContent(17)
(double) 11.000000
root [2] hJetPT->SetBinContent(17, 4.076e-13)
root [3] hJetPT->GetBinContent(17)
(double) 4.0760000e-13
root [4] .q
[user@lxplus746 home]$ root

root [0] TFile *_file0 = TFile::Open("file.root")
(TFile *) 0x4052530
root [1] hJetPT->GetBinContent(17)
(double) 11.000000
root [2]

I thought I had read in the primer that the files would save and update automatically on ending the session, but the bin content has not been saved. What should I do?
Thanks!

You need to open the file with the “update” option, and then write it before quitting.

TFile *_file0 = TFile::Open("file.root","update");
//...
_file0->Write();