Cleanup some edge conditions in polling
- Don't hold lock while sleeping
- Avoid derefing a None _snapshot after on_thread_exit() is called