allow removing plugins from notebook, plus other bug fixes

Fix Issue #77 by making clicking on an active plugin in the plugin manager remove that plugin if possible (ie it is unused).

Also fix Issue #568 , by just checking the item before adding it.

Also fix a longstanding unknown bug where the exit method was not called on plugins when the notebook was closed.