Fixed order of initialization on app.xaml.cs and changed WindowManager to use window.closed instead of window.closing