Error analysis of the spectral element method with Gauss–Lobatto–Legendre points for the acoustic wave equation in heterogeneous media