Clean up main loop when object is garbage collected

This cleans up resources and avoids polluting the goroutine space
without the need to call .Close (which is now obsolete).

Unit testing this gives me a weird artifact but it's better than
nothing.