Update classes of topic during close/reopen actions.

Add tests.
Bug: 68328

Change-Id: I15a09c5b057de8e7d24e5c1b953bd36dfe72a40c