crash fix

- changed the way notebook pages are deleted if only one is present
(DeletePage method caused a crash on MacOS with wxPython 3)
- added check when right click on history entry if no plot is displayed