Fix crash on exit: Close all cached sqlite connections