Remove connectionlistener before disconnecting.