PTSOPEN
if (! (flags & (PTMOPEN | PTSOPEN))) {
if (ptsp->pt_state & PTSOPEN) {
ptsp->pt_state |= PTSOPEN;
ptms_close(ptsp, PTSOPEN | PTSTTY);