Documents not persisted

Hello together,

if i execute my app with “process.exit(0);” at the end, my documents are not persisted.
First i await my result and then i want to exit my app like this:


If i wait a Second and then call "process.exit(0); "or remove “process.exit(0);”, the data will be persisted.

What may be wrong? Thank you in advance.