Fixed cache clear on application exit. Handled using existing or creating a new database.