Fix MPI termination issue and add iterative MPI testing