Fixed the blow issues

1.  Show progress while checking updates
2. Close DB while APP exit.
3. Refactor code