Fix infinite recursion on shutdown caused by incorrect onWidgetDestroy listener