Fixes memory leak where open chat windows leak instances on reconnections.