   def terminate(_, State[root: false]) do
     :folsom_metrics.notify({{Genomu.Metrics, Channels}, {:dec, 1}})
   end
-  def terminate(_, State[]) do
+  def terminate(_, State[crash_clock_file: f]) do
+    File.close(f)
     :ok
   end
 

    end

    @spec dump_crash_clock(t) :: t
    defp dump_crash_clock(__MODULE__[crash_clock: crash_clock, crash_clock_filename: f] = state)  do
      File.write(f, ITC.encode_binary(crash_clock))
      state
    end

    @spec read_crash_clock(t) :: ITC.t
    defp read_crash_clock(__MODULE__[crash_clock_filename: f]) do
      if File.exists?(f) do
        File.read!(f) |> ITC.decode
      else
        ITC.seed
      end
    end

    @spec memoize(Genomu.key, binary, t) :: t

    def initialize(__MODULE__[root: root, clock: nil] = state) do
      data_dir = Application.environment(:genomu)[:data_dir]
      filename = Path.join(data_dir, "#{inspect root}")
      unless File.exists?(filename) do
        new_file = true
      end
      {:ok, file} = File.open(filename, [:binary, :raw, :read, :write])
      state = state.crash_clock_file(file)
      if new_file do
        crash_clock = ITC.seed
      else
        crash_clock = :file.pread(file, 0, File.stat!(filename).size) |> ITC.decode
      end
      state.crash_clock(crash_clock).clock(crash_clock)
    end
    def initialize(__MODULE__[] = state) do
