move shutdown procedure from gdMainWindow to init_