Hello Sam,
Can you please check if the following modification in your script solves the problem.
Instead of line 12: n_t.frames.append((chunk.key, 0)) put the following:
if t.target == Metashape.Tasks.ChunkTarget:
n_t.chunks.append(chunk.key)
if t.target == Metashape.Tasks.FrameTarget:
n_t.frames.append((chunk.key, 0))