Hold reference to prepared stmt while executing

Since we use a weak-reference dict for caching prepared
statements, we need to make sure at least one reference
is held during executing to avoid it being GC'ed.
Fix bad on_remove call on sessions, listeners