High-pressure lattice dynamics and thermoelasticity of MgO