The Teleological Role of Comets in 17th and 18th Century Natural Philosophy