How to break out of a loop via a connection?

My bad, getting mixed up with task.
It should be coroutine.close() to completely close it, or coroutine.yield() if you wanted to resume it later on.