Fix the write closure to use the correct task info