When using sshpass the file descriptors leaks would happen in the reset
method that used _build_command that creates the pipe but the command
would not go through _bare_run which closes the pipe.
Another scenario would be _bare_run failing and not all code path would
properly close the pipe.
This patch fixes the issues by:
* move creating the pipe from _build_command closer to where it is used
in _bare_run
* wrap _bare_run with closing the pipe in case of a failure
* no need to re-create pipe in the retry code
* unrelated but simplify the reset method