The Whitehead torsion of a chain complex