Fix bugs

Fix Closing from systray clears database.
Fix undo/redo on search. Search is no longer a undoable command. Calling
undo on search returns to main screen