Added windowlistener : when closing, it disconnects for you.