osd: stray pg ref on shutdown

Move agent_clear() from only being done when becoming replica
  Do it in clear_primary_state() whenever we stop being primary
  clear_primary_state() passed whether we are staying a primary
Add asserts in agent_stop() and don't need to clear agent_queue

Fixes: #7458

Signed-off-by: David Zafman <david.zafman@inktank.com>
Merge pull request #1356 from ceph/wip-7458

osd: stray pg ref on shutdown

Reviewed-by: Samuel Just <sam.just@inktank.com>