Cleanup resources on shutdown. Multiple fixes to tests.

- Shutdown producer when channel is stopped.
- Ensure rolled back data is pulled out.
- Add tests to ensure that all data pushed before shutdown is pulled out.
- Refactor tests into multiple methods.