Switch Matrix block on handle rather than type
I think you already spotted it. 

Change:

&lt;ul class="small-block-grid-{{ textBlocks.blockGridNumber }}"&gt;


To:

&lt;ul class="small-block-grid-{{ block.blockGridNumber }}"&gt;