Shape-preserving accelerating electromagnetic wave packets in curved space