Close VT PTY's. Fixes #10404.
Only close FD's if open. Only wait if alive.
Test if we're closing open PTY's
Merge pull request #13383 from s0undt3ch/issues/10404-vt-ptys-not-released

[DO NOT MERGE] Fix #10404 vt ptys not released