add write_finished event