pty: fix possible use after free of tty->driver_data