private void closeCurrentDbMenuItem_Click(object sender, EventArgs e) { if (_applicationState.DatabaseLoaded && _applicationState.DatabaseExists) { if (IsDataModelChanged) { if (MessageBox.Show("Are you sure you want to save and close the current open database?", "SaveDatabase and close", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } _logicManager.SaveDatabase(); } if (CloseActiveDatabase()) { GC.Collect(); return; } } Log.Warning("CLose db was called without any loaded database."); MessageBox.Show("No database was loaded or found.", "Failed to close database", MessageBoxButtons.OK, MessageBoxIcon.Warning); }