In cases of voluntary separation or in cases where one spouse, against the will of that spouse, is abandoned or driven off by the other spouse, a party voluntarily, by contract or other written agreement made with his spouse, may make an adequate provision for the support and maintenance of such spouse, consistent with the means of the party and the former circumstances of the spouse. Such an agreement shall be a bar to the right of the spouse to permanent alimony.