When the ends of the coil are not connected, the coil acts as an inductor in which oscillations persist until the current decays slowly. When these ends are connected, the coil forms a close loop; hence, there is inductance across the ends and the coil does not behave like an inductor. Therefore, all oscillations stop at once.