Add test to make sure PD doctor exits cleanly.

This is mostly for the case where monitor heartbeats is off, as in
OOIION-1116. This patch also fixes the bug described there.