job_event: handle the non-empty dirty buffer when event file is closed