Added ability to terminate router and connect processes, as soon as they are done processing their part.