Move check for RPC server shutdown.

Move the check for RPC server shutdown above accept call, so that it
does execute when stop() was called.