title: OSError: [Errno 5] Input/output error python while generating big text file
body: <p>Hello i'm using the following python script to generate a list of combinations but after 20min or about 2gb generated I get "OSError: [Errno 5] Input/output error"</p>
  
  <p>My code:</p>
  
  <pre><code>with open(selectedreplacelist, 'r', encoding="ISO-8859-1") as replacemes:
      for replaceme in replacemes:
          replaceme = replaceme.rstrip('\n')
          if ('(kw)' in replaceme) or ('(KW)' in replaceme):
              with open(selectedkeywordlist, 'r', encoding="ISO-8859-1") as keywords:
                  for keyword in keywords:
                      keyword = keyword.rstrip('\n')
                      kwps.write(re.sub(r'(?i)\(kw\)', keyword, replaceme + "\n"))
          else:
              kwps.write(replaceme + "\n")
  </code></pre>
  
  <p>extra info:
  Running ubuntu 18, someone else tried on windows and it worked fine
  kwps = txt file it saves the generated cobinations to on my new samsung t5 ssd</p>