first attempt at resolving locked shapefile problem, patch from laurentg