uml: fix error cleanup ordering