Reject code with un-closed open brackets

[closes #1150]