public static void CloseWindow()
 {
     // just to make sure it was opened
     if (window != null)
     {
         window.Close();
     }
 }