I placed it after the sleep to allow it to wait till after the killall has killed the process to remove the pid.