private static void CloseInstance() { lock (_lockObject) { if (_instance == null) { throw new Exception("Dialog instance does not exist"); } _instance.Owner.Enabled = true; _instance.Close(); _instance.Dispose(); _instance = null; } }