Krita (5.3.1) closes/crashes when script closes the only open document

I have a script that is exporting a bunch of assets from a single Krita file. The script makes changes to the document that would not be good to accidentally save (changing the resolution), so I make sure to automatically close the document after the script is run. The script runs without any issues, everything exports and any logging I put at the end of the script is output. If there are no other documents open when the script finishes, however, Krita freezes for a few seconds and closes. I don’t see any complaints in the logs so I’m not sure this is a crash or whether this is expected behavior. I can work around this but I would prefer it not do this. I’m curious if there is something I can do to prevent this from happening?