I think you might need to do something special for cloned workunits - which have been created by cloning a query in a query set.  You don't want to delete the dll since it is shared, and really owned by the queryset wu.

Also, if you are deleting a dll you should remove the entry in the DllServer directory.  (If archiving does it get removed and then restored?)