Similar Items: Automata with Nested Pebbles Capture First-Order Logic with Transitive Closure