destroying rapid on window close