How to turn relay 1 on and then turn 2 off first and then 1?

So i have a bit of a problem i need my relay 1 to turn on and after than i can turn the relay 2 on or off but when i want to turn relay 1 off i need relay 2 to turn off first if this relay is on.

rule "Switch1 ON"
when
    Item Switch1 changed to ON
then
    Relay1.postUpdate(ON)
    Relay2.postUpdate(ON)
end

rule "Switch1 OFF"
when
    Item Switch1 changed to OFF
then
    Relay2.postUpdate(OFF)
    Relay1.postUpdate(OFF)
end

You could wrap the second command in each of Harry’s example rules in a timer() function, if you wanted them to fire after a delay.