I tried the disconnect. Unfortunately the code does not continue past the channel exec. If you throw in the $ssh->disconnect, it never even gets there.
blocking(0) seems to have no effect. I had actually tried that, forgot to mention it.
OpenSSH: Yeah, thought of that as well but the code has to be usable from multiple different systems.