DataSave with pcall() not working properly?

Hey! I added a pcall() to my Data Save to stop potential Data loss, but instead of stopping data loss, it caused it. Sometimes the data resets back to a certain point. I have no idea what the problem is.

local P2WIDs = {}
local checking = false
game.Players.PlayerAdded:Connect(function(player)
	local success, Data = pcall(function()
		if checking == false then
			checking = true
			local id = P2WDataStore:GetAsync("paytowin")
			if id then
				for i, userId in pairs(id) do
					table.insert(P2WIDs, userId)
				end
			end
		end
	end)
	
	if success then
		print("Successfully Loaded")
	else
		player:Kick("Your data didn't load in, rejoin after a few seconds.")
		error(player)
	end
end)

local function saveP2WIDs(player)
	local success, errorMessage = pcall(function()
		P2WDataStore:SetAsync("paytowin",P2WIDs)
	end)
	if success then
		print("Saved Data")
	else
		print("Error: "..errorMessage)
	end
end

game.Players.PlayerRemoving:Connect(function(player)
	saveP2WIDs(player)
end)

game:BindToClose(function()
	for i, player in pairs(game.Players:GetPlayers()) do
		saveP2WIDs(player)
	end
end)