ifchanged problem

I have this loop:

{% for shift in shift %}

            {% ifchanged shift.weeknr %}
                <div class="weeknr allcolumn"><h1>Week: {{ shift.weeknr }}</h1></div>

                    <div class="grid-container shifts"><!--START SHIFTS-->

            {% endifchanged %}

                <div class="day{{ shift.weekday }}">

                    {% ifchanged shift.weekday %}
                        <div class="dayheader">{{ shift.start_date }}</div>
                    {% endifchanged %}

                    {% include shift.status.template_name %}

                </div>

                    </div><!--END SHIFTS show only when weeknr changes-->

    {% endfor %}

I want the last DIV within the for loop to apear only when the weeknr changes. I just can’t get it working. I need it is to close the grid container div:

<div class="grid-container shifts"><!--START SHIFTS-->

Can’t you wrap it another call to {% ifchanged ... ?