Water and most fluids are comparatively incompressible and heavy. When they flow down a pipe, depending on the diameter and length, there is a weight of fluid in motion. If a valve at the end of the pipe is suddenly closed, the momentum of the fluid is changed and this will give rise to forces on the valve and within the pipe. This is called Water Hammer
and can, depending upon the magnitude of the force, be very damaging.
For this reason large pipe-lines can not be suddenly shut off and closure takes place over a considerable period of time. The problem also occurs on small bore pipes but here the effect is usually a knocking noise. However worse can happen and in the experience of the author water hammer forced apart a two inch compression coupling in a laboratory and a few thousand gallons of water cascaded down over an electron microscope.
The analysis of Sudden Valve Closure and Water Hammer can either be done assuming that water is completely incompressible and the pipe totally rigid or by assuming that there will be some compression of the water and some expansion of the pipe.