fix(util/script_state): deadlock, add example exposing the problem

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>