It turned out there were two territories still included in the place.txt that I wanted to remove from the module. I thought removing their place boxes would do the job but they actually were still in the place.txt, just without any coordinates. This caused the String Index Out Of Bounds error. Lesson learned!