Collapse dynamics of spherical cavities in a solid under shock loading