Same here. I used weakref to resolve it.
added weakref for closured render function
Break up a reference cycle with RequestHandler.ui when handler exits …
This is not strictly necessary, but allows for CPython's refcounting
GC to reclaim the handler sooner than waiting for a full GC.