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>