Runs the task until it doesn't come to the end successfully