code to stop a running process