When does terminate get called?