close the cstore connection before return