This routines must be called by each slave (master) before it exits. This
call cleans all MPI state. Once mpi.finalize has been called, no MPI
routine may be called. To be more safe leaving MPI, please use
mpi.exit which not only calls mpi.finalize but also
detaches the library Rmpi. This will make reload the library Rmpi impossible.