Thanks for the suggestion. I just extracted my NSIS .exe with 7zip and then opened the database with sqlitebrowser.
http://sqlitebrowser.org/Everything went fine with opening the database, so it seems it has either something to do with an incorrect path or somehow it corrupts the PyInstaller .exe (but with an external database everything works fine?).
I don't know what changed, but when opening the NSIS .exe with 7zip now, it doesn't give an error extracting the PyInstaller .exe anymore.
However when trying to run the extracted PyInstaller .exe, I get the following error:
PyInstaller Bootloader 3.x
LOADER: executable is D:\path\KanjiOrigin\KanjiOrigin.exe
LOADER: homepath is D:\path\KanjiOrigin
LOADER: _MEIPASS2 is NULL
LOADER: archivename is D:\path\KanjiOrigin\KanjiOrigin.exe
LOADER: pyi_arch_check_cookie failed
LOADER: archivename is D:\path\KanjiOrigin\KanjiOrigin.pkg
LOADER: Cannot open archive: D:\path\KanjiOrigin\KanjiOrigin.pkg
Cannot open self D:\path\KanjiOrigin\KanjiOrigin.exe or archive D:\path\KanjiOrigin\KanjiOrigin.pkg