<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def on_app_shutdown(self, app):
        '''Dump profile content to disk'''

        if self.filewatcher:
            self.filewatcher.stop()
        if self.profile:
            self.upload_page.on_destroy()
            self.download_page.on_destroy()