title: sqLite3.ProgrammingError when trying to run python manage.py dumpdata
body: <p>I am trying to run python manage.py dumpdata &gt; data.json and it's giving me this error.</p>
  <blockquote>
  <p>CommandError: Unable to serialize database: 'charmap' codec can't
  encode characters in position 1-8: character maps to 
  Exception ignored in: &lt;generator object cursor_iter at
  0x0000029AAC7E9E00&gt; Traceback (most recent call last):   File
  &quot;C:\Users\jsalv\Desktop\ItPartsECommerce\myenv\lib\site-packages\django\db\models\sql\compiler.py&quot;,
  line 1876, in cursor_iter
  cursor.close() sqlite3.ProgrammingError: Cannot operate on a closed database.</p>
  </blockquote>
  <p>The code that is throwing the error is the following:</p>
  <pre class="lang-py prettyprint-override"><code>def cursor_iter(cursor, sentinel, col_count, itersize):
      &quot;&quot;&quot;
      Yield blocks of rows from a cursor and ensure the cursor is closed when
      done.
      &quot;&quot;&quot;
      try:
          for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
              yield rows if col_count is None else [r[:col_count] for r in rows]
      finally:
          cursor.close()
  </code></pre>
  <p>The error comes out but the file gets generated, when it does it's never full, the last lines do not close out and because of that I cannot migrate my database to PostgreSQL, I tried saving this file with UTF-8 decode but it didn't work. Can anyone tell me if I'm doing something wrong?</p>