Chromosomal rearrangements preserve adaptive divergence in ecological speciation