Check if terminal device exists before opening it