Factor out killProcess