Fix Interface/Server close mechanism. Works and checked for both tcp and tty.