Fix a lexer bug, and add a regression

  Closing brackets weren't closing virtual layout blocks.