Fixed plenty of bugs

- Fixed the crashes happening on safe shutdown
- Now there is a chance to restore wallets from '.keys' files
- Enhanced dialog management