Stop RestApiService during the graceful shutdown.

Stop it early to avoid any config changes during the shutdown.