Properly closes the communication on exit ( When Pressing escape )