Universal Behavior of the Scattering Matrix Near Thresholds in Photonics.