Entanglement and thermodynamics after a quantum quench in integrable systems