Fix segfault on error'ed mbtiles connection