diff --git a/packages/beacon-node/src/node/nodejs.ts b/packages/beacon-node/src/node/nodejs.ts index 6e129076848c..3c9f2ec0b54b 100644 --- a/packages/beacon-node/src/node/nodejs.ts +++ b/packages/beacon-node/src/node/nodejs.ts @@ -317,10 +317,10 @@ export class BeaconNode { this.status = BeaconNodeStatus.closing; this.sync.close(); this.backfillSync?.close(); + if (this.restApi) await this.restApi.close(); await this.network.close(); if (this.metricsServer) await this.metricsServer.close(); if (this.monitoring) this.monitoring.close(); - if (this.restApi) await this.restApi.close(); await this.chain.persistToDisk(); await this.chain.close(); if (this.controller) this.controller.abort();