Never mind; I got it. All I had to do was check the Closed property of the stateList variable. If it's "true", I skip to the next one. If it's "false", I append it as normal.
i < stateList.Count
Skip: System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)