<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def close_page(self, state_identifier, delete=True):
 """Closes the desired page The page belonging to the state with the specified state_identifier is closed. If the deletion flag is set to False, the controller of the page is stored for later usage. :param state_identifier: Identifier of the page's state :param delete: Whether to delete the controller (deletion is necessary if teh state is deleted) """

        # delete old controller references
        if delete and state_identifier in self.closed_tabs:
            self.destroy_page(self.closed_tabs[state_identifier])
            del self.closed_tabs[state_identifier]

        # check for open page of state
        if state_identifier in self.tabs:
            page_to_close = self.tabs[state_identifier]['page']
            current_page_id = self.view.notebook.page_num(page_to_close)
            if not delete:
                self.closed_tabs[state_identifier] = self.tabs[state_identifier]
            else:
                self.destroy_page(self.tabs[state_identifier])
            del self.tabs[state_identifier]
            # Finally remove the page, this triggers the callback handles on_switch_page
            self.view.notebook.remove_page(current_page_id)