fixed focus on right click in the treeview
fixed saving documents on exit