Making sure the telnet connection is closed after each command