try to fix the error "pipe closed" throught adding sftpReConnect
function.Causes the error may relate with channel closed...
a little modify for format