BindToClose and PlayerRemoving both not working for me?

BindToClose and PlayerRemoving both not working for me?
So this is my code

game.Players.PlayerRemoving:Connect(function(p)
	adata:SetAsync(p.UserId,p.leaderstats.Speed.Value)
	bdata:SetAsync(p.UserId,p.leaderstats.Prestige.Value)
	cdata:SetAsync(p.UserId,p.leaderstats.Cash.Value)
end)
game:BindToClose(function()
	if #game.Players:GetPlayers()<=1 then
		coroutine.wrap(function()
			print('e')
		end)
	end
end)

When I leave it doesn’t print neither of anything from any of those two functions. How am I supposed to save data then?

For PlayerRemoved, you are not printing anything. For bind to close, using a coroutine will not cause yielding and the game will close before the thread is run.