private void MainForm_Closing(object sender, FormClosingEventArgs e) { allDevices.Disconnect(); cts.Cancel(); Application.Exit(); }