There is a bug in the error path of log_force_sync where if we get an error we can leave the function without closing the local file handle.