Use closure to prevent traitlet callbacks from firing twice.