setDirty();
        SaveFileDialog saveFileDialog1 = new SaveFileDialog();
        saveFileDialog1.Title = "";
        saveFileDialog1.OverwritePrompt = true;
        var dialogResult = saveFileDialog1.ShowDialog();
        if (dialogResult == DialogResult.OK)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("CheckLoggin = {0}", chkLoggin.Checked).AppendLine();
            sb.AppendFormat("LogFilePath = {0}", txtFilePath.Text).AppendLine();
            sb.AppendFormat("NumberOfThreads = {0}", txtNumOfThreads.Text).AppendLine();

            File.WriteAllText(saveFileDialog1.FileName, sb.ToString());

            saveFileDialog1.Close();
        }
    }

Replace saveFileDialog1.Close(); with Application.Exit();

saveFileDialog1.Close(); terminates the application

problem solved thanx ChrisHunter