The issue was that cmd.Wait() was being called multiple times on the same
process - once in the background goroutine and once in Close(). This could
lead to zombie processes because only the first call to Wait() properly
reaps the process.
The fix uses sync.Once to ensure Wait() is only called once per SSH process,
storing and returning the result on subsequent calls.
Added tests to verify the fix works correctly.
Co-authored-by: ncw <536803+ncw@users.noreply.github.com>