[JENKINS-21601] fix to close open ssh sessions
when running an init script.