Fix process.exit() stop fs from writing the JSON file