Only endArray if in array mode. So if there is an exception it won't be
hidden by misplaced array exception.