added check for 'too many brackets' in order to catch extra closing brackets before EOF or opening brackets at the start of the program