How fish fins evolved just before the transition to land