Destroying an infinite loop