Add spec to verify prematurely closed layout is properly rendered.

This test currently fails against dev branch.

Provides test coverage for pr #642.