add leave_on_terminate config flag