You're right, but it's weird for such a tech-focused company to close stores in such a fashion, because we're used to the giant margins of tech. Apple has never closed that many stores that quickly.
Apple stores are famous for being some of the most profitable stores mankind has ever created. And there aren't that many of them.
These Amazon stores are just local convenience stores. They're selling candy bars. And Amazon is a much more "experimental" company than Apple -- they launch and shut down stuff all the time to iterate and learn. This isn't about penny-pinching or margins, it's about finding product-market fit.
Which is just business as usual, figuring out which stores in which locations turn out to be most profitable.