Fix for listenToOnce mem. leak

This is a failing test demonstrating #3226, then a patch that makes the test pass.
I'm not sure how much cleaner this is here. I'd rather see a plain function for this than invoking 2 new closures