<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _finalize(self):
 """Reset the status and tell the database to finalize the traces."""

        if self.status in ['running', 'halt']:
            if self.verbose > 0:
                print_('\nSampling finished normally.')
            self.status = 'ready'

        self.save_state()
        self.db._finalize()