{Reviewer: Mike} Fix leaking of flows.

Mike, this is just some preliminary work to fix https://github.com/Metaswitch/sprout/issues/137 before I actually start on bono scaling down.