set self.window to nil after use