impl callback when window is closed, and update information on window