Fixes to properly stop at onion_listen_stop. Added test.