debug close window function