Three-time Olympic gold medallist Max Whitlock "felt like a complete failure" when he contemplated stepping away from th