core: properly dispose of sqlite connection