Fixed bug with MPI finalization