make test more portable
tests cleanup
pty fds not being closed
fix pty fd methods