Can't save leaderstats

Where should I add this code?

game.Players.PlayerRemoving:Connect(function(plr)

game:BindToClose(function()
	dataStore:SetAsync(plr.UserId, plr.questvalues.quest1.Value)
	wait(3)
end)

end)

This is what I did.