From securing alimony to reskilling, here’s what women in their 40s or 50s need to do before walking out of a long marriage.