stop script when render is cancelled

Hi,
i'm a newbie sorry and i have problem il my first script:

i have 3 vray renders in vrayframebuffer to launch Successively with different parameters , and i want to stop the script when user decides to cancel one of the render.
the simply way was to use a function like this for each render :

bm = render cancelled:&wasCancelled
if (not wasCancelled) do....

it's good but the problem is when doing this, vray frame buffer open calculate and close and then re open with cleared image and start second image...

with the max quick render command vray calculate the first render, doesn't close and clear the vray frame buffer ,and begin the second image (perfect for me) but it's impossible to stop all the renders in one esc pressed!!!

is there anyone who could help me?....
thanks much for any idea
best regards to all
eric