diff --git a/Database/APR/RootStorageSvc/src/RootDatabase.cpp b/Database/APR/RootStorageSvc/src/RootDatabase.cpp
index 3cfe6725b0428e84826f7a149d6750c5d6e88052..01e194f2f78fd030513f6562501dd06890db92af 100644
--- a/Database/APR/RootStorageSvc/src/RootDatabase.cpp
+++ b/Database/APR/RootStorageSvc/src/RootDatabase.cpp
@@ -767,7 +767,7 @@ void RootDatabase::registerBranchContainer(RootTreeContainer* cont)
 DbStatus RootDatabase::transAct(DbTransaction&  refTr )
 {
    // process flush to write file
-   if( refTr.state() == Transaction::TRANSACT_FLUSH ) m_file->Write();
+   if( refTr.state() == Transaction::TRANSACT_FLUSH && m_file != nullptr && m_file->IsWritable()) m_file->Write();
    // process commits only
    if( refTr.state() != Transaction::TRANSACT_COMMIT )
       return Success;