A chromosomal inversion may facilitate adaptation despite periodic gene flow in a freshwater fish