Removed unnecessary import.
Added code to interrupt popup when needed so.
Added code to interrupt and delete a connect popup when needed.
Added extra check not to throw exception when sockets are closed by user.