Use more common for loop pattern
Don't try to get the exit code when the process is not yet dead

That causes an exception to be thrown, which currently prevents the stuck slim
process from being properly killed.
Merge pull request #376 from raboof/kill_stuck_slim

Regression: a stuck SlimClient is no longer killed