Add StateAt functor and fix CLOSTESTTOBEAM
This adds a functor STATE_AT
returning the tracks state requested by name from the state location enum. The CLOSESTTOBEAM
functor utilises this now and thus actually always returns the CTB state or throws if not present. The old behaviour of CLOSTESTTOBEAM
is now covered by TRACKSTATE
which makes it more clear that it is the track defining which state is returned here.
Related to #392