Fixed destroying of window