The execution is imperative (from top to bottom).
The attribute index is enabled by default, so you can drop CREATE INDEX:
CREATE DB wlc-trees ./trees RUN ./xquery/add-wlc-verses-words.xq OPTIMIZE
If you want to keep your attribute index updated, you can enabled the UPDINDEX flag:
SET UPDINDEX true CREATE DB wlc-trees ./trees RUN ./xquery/add-wlc-verses-words.xq
Hope this helps.