fix KeyError in destroy_window