unsort: handle stdout early close