private void Form1_FormClosing(object sender, FormClosingEventArgs e) { SharedData.closeBackend = true; httpserver.StopServer(); try { irchandler.Shutdown(); } catch (Exception ex) { Debug.WriteLine("DEBUG-MAIN: Could not close irc :( "); Debug.WriteLine(ex.ToString()); } try { websocketserver.Stop(); } catch (Exception ex) { Debug.WriteLine("DEBUG-MAIN: Could not close websocketserver :( "); Debug.WriteLine(ex.ToString()); } Debug.Flush(); Debug.Close(); Cef.Shutdown(); Environment.Exit(0); }