diff --git a/GenericIO.h b/GenericIO.h
index 9832f1fa8dc2a589ab48dbd432bddd75d1264833..04df4cc96db3bab82de37905528ab64259907136 100644
--- a/GenericIO.h
+++ b/GenericIO.h
@@ -462,15 +462,24 @@ public:
   static void setNaturalDefaultPartition();
 
   static bool flushAll() {
+      bool ret = true;
 #ifdef GENERICIO_WITH_VELOC
-      return GenericFileIO_VELOC::flush();//With veloc do a blocking flush of anything outstanding and return if all outstanding tasks were successful
+      bool retLocal = GenericFileIO_VELOC::flush();//With veloc do a blocking flush of anything outstanding and return if all outstanding tasks were successful
+#ifndef GENERICIO_NO_MPI
+      MPI_Allreduce(&retLocal, &ret, 1, MPI_C_BOOL, MPI_LAND, MPI_COMM_WORLD);//Global reduction on if flush was successful 
+#else
+      ret = retLocal;
 #endif
-      return true;//by default return that flush was successful (as it does not do anything)
+#endif//GENERICIO_WITH_VELOC
+      return ret;//by default return that flush was successful (as it does not do anything)
   }
 
   static void shutdown() {
 #ifdef GENERICIO_WITH_VELOC
       GenericFileIO_VELOC::flush();
+#ifndef GENERICIO_NO_MPI
+      MPI_Barrier(MPI_COMM_WORLD);//Barrier to wait for all ranks to finish
+#endif
 #endif
   }