widgets: add cleanup handlers

Ref #26