The thing I don't get is why anyone is remotely surprised that Walmart left as soon as it made economic sense to do so. This is literally what corporations do. They are economic engines. They are designed from the ground up not to give two shits about the impact of their decisions on the community to the extent that doesn't jive with their own economic interests.
Should Walmart (or any other company) do something different? Your comment reads to me as if you believe that Walmart should keep stores open even as they are losing money, which seems totally nonsensical to me.
I get what you're saying, but it's more that we shouldn't be looking to corporations to make moral decisions. I do think that there's something unhealthy about our society that its most powerful actors are set up thus, but that's where we need systemic change rather than expecting one company to go against the grain for shits and giggles.