I notice you have a session.RunMacro() in the "middle" of your code. The session.RunMacro()'s will not run until the end of your code. Running multiple session.RunMacro()'s will give suprising results...
Weblink and jlink session.RunMacro() only runs when control is returned to Creo Parametric. From the weblink api docs:
void RunMacro (string Macro)
Runs the specified macro.
Macros may only run when control is returned to Creo Parametric. If control is maintained by a J-Link program, the macro will be stored for later running. Parameters: Macro The macro to run