fssh: factored out terminate_process() function