Merge "Remove lock around ref count check in terminate." into lmp-mr1-dev