Gas switching procedure with 3 stages