<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flush(self):
 """Erases queue and set `end-of-queue` message."""

        while not self._queue.empty():
            self._queue.get()
            self._queue.task_done()
        self.close()