Hi
You can use terminating events in a fork which is parallel to your decision task...make it 1 of 2 fork.
In your custom code, when everything is done, you just trigger the terminating event (without knowing the WI ID)....you just need to have the right key of the base object of the workflow.
When the system generates the terminating event, the system will also search for the "listening" instances which have the same key and will end them.
Some links to help you with Terminating Events and Forks (
http://help.sap.com/saphelp_erp2004/helpdata/en/c5/e4b590453d11d189430000e829fbbd/content.htm
http://scn.sap.com/thread/404983
Forks (SAP Library - Embedded Processes (SAP Business Workflow))
How to model parallel branching/fork in SAP workflow - YouTube
Regards,
Modak