```typescript
export function parseCsvLine(line: string): string[] {
  if (typeof line !== 'string') {
    throw new Error('Invalid argument');
  }

  const result: string[] = [];
  let inQuotes = false;
  let currentField = '';

  for (let i = 0; i < line.length; i++) {
    const char = line[i];

    if (char === '"') {
      if (inQuotes) {
        // Close the quote
        inQuotes = false;
        if (!currentField || hasTrailingSpace(currentField)) {
          throw new Error('Unmatched closing quote in a field');
        }
        result.push(currentField);
        currentField = '';
      } else {
        // Open a quote
        inQuotes = true;
      }
    } else if (char === ',' && !inQuotes) {
      // Split at fields
      if (!result.length || hasTrailingSpace(result[result.length - 1])) {
        throw new Error('Unmatched closing quote before reaching the end of the line');
      }
      result.push(currentField);
      currentField = '';
    } else {
      // Append to the current field
      currentField += char;
    }

    if (i === line.length - 1) {
      if (!currentField || hasTrailingSpace(currentField)) {
        throw new Error('Unmatched closing quote before reaching the end of the line');
      }
      result.push(currentField);
    }
  }

  return result;
}

function hasTrailingSpace(str: string): boolean {
  // Assume space is defined as a single character
  if (str.length === 0) return false;
  const lastChar = str.charAt(str.length - 1);
  return lastChar === ' ';
}
```