Adiabatic dynamics of many-body systems close to a quantum critical point