input: Write a python function to count the frequency of each word in a given text file and return the top N most frequent words.
  assert top_n_frequent_words('war_and_peace.txt', 3) == [('the', 12345), ('and', 6789), ('to', 4567)]
  assert top_n_frequent_words('war_and_peace.txt', 5) == [('the', 12345), ('and', 6789), ('to', 4567), ('of', 3456), ('a', 2345)]
  assert top_n_frequent_words('war_and_peace.txt', 1) == [('the', 12345)]
output: def top_n_frequent_words(file_path, N):
      from collections import Counter
      import re
  
      with open(file_path, 'r', encoding='utf-8') as file:
          text = file.read().lower()
      
      words = re.findall(r'\b\w+\b', text)
      word_counts = Counter(words)
      most_common_words = word_counts.most_common(N)
  
      return most_common_words