Throw exception when count of closing brackets don't match opening brackets