I agree with a few suggestions above. If you are dead set on leaving the band, tell them before the gig you are quitting, but will play the gig so as not to leave them high and dry. As someone said above, if they decide you can walk before the gig because they've got a replacement, then...