It seems the geometry is not changed through DetectorMessenger class?

i want to do a simulation with targets of many thickness, so the DetectorMessenger class is used,
the Run.mac file is uploaded;
when execute the Run.mac file, two problems occur:
one is the results are not right, i seems the thickness of the target is not changed by the command:
“/fp/det/SetTargetThickness”
the thickness of the target is always the value 0.5 mm specialize by first time
the second problem is the application exit before all runs end.
so how to update the the geometry before “/run/beamOn”.
Run.txt (4.8 KB)

I use the codes below to Update Geometry,

if(PhysicalWorld)
{
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
}

but the Geometry still the same,
is there something else i should do?
thanks!