Fix freezing on bare ')' with alternative layout rule (#8431)

Patch by errge