What causes taps to make a loud bang sound when quickly closed?
As Sheetmetal85 mentioned in the comments, you are hearing "Water Hammer". This is probably happening in one of two ways: 


When shutting the water off quickly, the force of all the moving water is banging against your faucet causing a "thunk"
When shutting the water off quickly, the force of the moving water causes your pipes to shake causing some noise not directly next to the faucet (this could be due to unsupported pipes, some pipe straps that have worn down, really anything keeping pipes from remaining stationary)


Start by looking for something that could be shaking, including the sink itself, when the water is shut off quickly, and tying down whatever is doing the shaking. Other than that, the next best solution is a thing called a water hammer arrestor, which basically acts like a cushion to absorb the force of the water and prevent pipes from shaking.