Stopping UnloadLibrary switching to the Gateway application (NX 10)

I am using a VB.Net Windows Forms Application executable that is called from a command button on an NX toolbar, which exits using UF.UnloadLibrary.

This function always switches the application to Gateway, where as I would prefer to stay in the application NX was in when the executable was called.

I can use ApplicationSwitchImmediate to change to an application different to the one NX was in when the executable began but if I try to change to the original workbench then it still ends up in Gateway.

ApplicationSwitch from an original Manufacturing to Modeling shows in the NX title bar upon ending the executable:
Manufacturing -> Modeling -> Gateway -> Modeling (OK but odd.)

ApplicationSwitch from Modeling to Modeling shows in the NX title bar upon ending the executable:
Modeling -> Gateway (Not good)

Multiple ApplicationSwitch commands all show in the NX title bar but if the final application is the same as the original then it always end up in Gateway.
For example an ApplicationSwitch from Modeling to Manufacturing and back to Modeling shows:
Modeling -> Manufacturing -> Modeling -> Gateway (Not good)

This is the only thing tripping me up at the moment, can anybody help?

The text in the NX title bar changes when you switch applications? This sounds very odd to me; I don't recall ever seeing this behavior. Is your code explicitly changing the title text or is it a result of running a certain API command? Is the behavior the same if you change the unload option?

The unload option never gets reached if I run with a startup form in an executable.

It is definitely the UF.UnloadLibrary API command that switches to Gateway (if I place this into a DLL which otherwise reaches the unload option then it behaves the same way).

I would suggest contacting GTAC; it sounds like this may be a bug or at least they may be able to explain why it works this way and offer a work-around.