Checks whether braces are valid