document: fix crash in editortoolbar on document close
actionmanager: free memory when removing action

Close #204