<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_close(self):
 """ Called by the server when the App have to be terminated """

        self._stop_update_flag = True
        for ws in self.websockets:
            ws.close()