Remove agent (rebased onto develop)



This is the same as gh-910 but rebased onto develop.

----

Remove entries from menu when all instances of the agent are discarded.
https://trac.openmicroscopy.org.uk/ome/ticket/10527

To test:
 * Open a viewer and a Measurement tools.
 * Check the Windows menu. You should have a sub-menu ```Image Viewer``` and a sub-menu ```ROI tools```
 * Close the viewer: MT and Viewer should be discarded
 * Check that the Windows menu does not have a sub-menu ```Image Viewer``` nor a sub-menu ```ROI tools```