Groovy language - start/stop/switch application

Hello, I have a few questions regarding how to code this in groovy language.

I use this to start an application:
def proc = new ProcessBuilder( args )
Process process = proc.start()

My questions are:

  1. How do I destroy this application?
  2. How do I switch to this application window (to make sure the window is always active)

Best Regards
Olof