properly quit after exporting