Fixed race condition

*sometimes*, on first run, the db would be created at just after the
list view was populated, causing errors. (the main window opens in a new
thread)