Updated killProcess to wait before continuing to make sure the killed process is actually killed