Improves process stopping.
Fixes #293.