private void Window_Closed(object sender, EventArgs e) { KM.Disconnect(); // make sure KM is disposed SaveConfig(CFiles); }