Encapsulate the finish semaphore in example code

Just a small change to the example code to encapsulate the finish chan