You might want to double check this -- mpirun shouldn't be waiting on you hitting return. Check to make sure you don't just have line-buffered output in python, or somesuch. Or better yet, check from python that the PID has actually disappeared and don't rely on stdout, or something like that.