Safe disconnection when user click on exit button added