ensure iterator end & next don't conflict

Race condition possible when you have a next() executing but end() is
also called. In the main JS thread we can create a barrier to protect
against this condition.
add test-10k-times.sh script
allow one next() at a time, improve end() handling
minor style tweaks
memory leak, Persistent callback not Disposed
explicit namespaces, tighter line wrapping