diff --git a/io/io/src/TFile.cxx b/io/io/src/TFile.cxx
index 0b8698671b8d7eacf25d0bee5173c5578c70f3e6..4c91e88ae175700efe92f7ad0e25decd267cca5a 100644
--- a/io/io/src/TFile.cxx
+++ b/io/io/src/TFile.cxx
@@ -876,9 +876,6 @@ void TFile::Close(Option_t *option)
       WriteStreamerInfo();
    }
 
-   delete fClassIndex;
-   fClassIndex = 0;
-
    // Finish any concurrent I/O operations before we close the file handles.
    if (fCacheRead) fCacheRead->Close();
    {
@@ -908,6 +905,9 @@ void TFile::Close(Option_t *option)
    if (gMonitoringWriter)
       gMonitoringWriter->SendFileCloseEvent(this);
 
+   delete fClassIndex;
+   fClassIndex = 0;
+
    // Delete free segments from free list (but don't delete list header)
    if (fFree) {
       fFree->Delete();