The energy requirements of ion homeostasis determine the lifespan of starving bacteria