<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def handle_selected_page(self):
 """ Open the subscription and submission pages subwindows, but close the current page if any other type of page is selected. """

        if not self.selected_page:
            pass
        if self.selected_page.name in ('subscription', 'submission'):
            # Launch page in a subwindow
            self.selected_page = self.selected_page.loop()
        elif self.selected_page.name in ('subreddit', 'inbox'):
            # Replace the current page
            self.active = False
        else:
            raise RuntimeError(self.selected_page.name)