Cleans up example code
Adds function to stop an open stream
Adds test for stopping stream