Changed thermostat now oil leak (2019 CX-9)

Change the thermostat in a 2019 Mazda CX9 grand touring. It was running OK and then about 50 miles from driving it said to pull over immediately which I did. Lifted the hood and noticed in the back was leaking oil underneath, nowhere near the thermostat I just changed. I’m not sure if possibly a blown head gasket, or valve cover, because the check engine light, and the battery light came on.