Close error overwrites write error

Code reviewHard18 minGoogle and Uber style

Your task

Review this Go function that writes a record to a file and closes it in a deferred call.