changed SQLite connection to use a with clause