<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_hit(self, hit):
 """Add a hit to the file."""

        if not self._csv:
            raise 'Open before write'
        self._csv.writerow(hit)
        self.number_of_hits += 1
        # Todo: check performance for timestamp check
        # assert self._path == self.get_filename_by_timestamp(timestamp)
        timestamp = hit['timestamp']
        if self.latest_timestamp <= timestamp:
            self.latest_timestamp = timestamp