If you are using "auto telnet), this can be done if DCD is wired to the dumb terminal (altpin setting if using 8 wire cable) and the serial port profile is configured for “modem out”. When the terminal is powered off, DCD drops and the connection is terminated.
Another option might be to set a keepalive for TCP where idle sessions would time-out: