Cavendish wins in closest finish in TOC history