A senior county fire officer at the centre of an investigation over sexist Whatsapp messages has resigned.