Fix shutdown-related bug in MPIContext.