Stability and Failure of Spherical Cavities in Unconsolidated Sand and Weakly Consolidated Rock