Resonant-state expansion for periodic open optical systems