Stability of Bose-Einstein condensates in a Kronig-Penney potential