Database is closed on Main Window Close Event