Underwater explosion bubbles III. The effects of the surface and the bottom on the shape and motion of the bubble