Remove notice if block is not closed (#443)

As reported in #443 an notice is being thrown if `$this->env->parent` is checked. I turned the proposed solution in a pull-request.