Fixed the termination of the processes