diff --git a/cmd/headers/download/downloader.go b/cmd/headers/download/downloader.go
index 0bc74949d4a75bc3f4159b7d7ca562734e069aad..cc5294d0368902935ed16f19ed99436e2a8ffb1b 100644
--- a/cmd/headers/download/downloader.go
+++ b/cmd/headers/download/downloader.go
@@ -418,12 +418,12 @@ func (cs *ControlServerImpl) loop(ctx context.Context) {
 	cs.sendRequests(ctx, reqs)
 	for {
 		select {
+		case <-ctx.Done():
+			return
 		case <-timer.C:
 			log.Info("RequestQueueTimer ticked")
 		case <-cs.requestWakeUp:
 			log.Info("Woken up by the incoming request")
-		case <-ctx.Done():
-			return
 		}
 		cs.hdLock.Lock()
 		reqs := cs.hd.RequestMoreHeaders(uint64(time.Now().Unix()), 5 /*timeout */)
diff --git a/cmd/integration/commands/refetence_db.go b/cmd/integration/commands/refetence_db.go
index 7fb5e178f68b2bc0ce22da85d1ae45f677a542b7..982cc4704a20b1d141a46b90ce0cf40c8055a8f5 100644
--- a/cmd/integration/commands/refetence_db.go
+++ b/cmd/integration/commands/refetence_db.go
@@ -342,6 +342,8 @@ func toMdbx(ctx context.Context, from, to string) error {
 
 			select {
 			default:
+			case <-ctx.Done():
+				return ctx.Err()
 			case <-logEvery.C:
 				log.Info("Progress", "bucket", name, "key", fmt.Sprintf("%x", k))
 			case <-commitEvery.C:
@@ -357,8 +359,6 @@ func toMdbx(ctx context.Context, from, to string) error {
 				if b.Flags&dbutils.DupSort != 0 && !b.AutoDupSortKeysConversion {
 					appendFunc = c.(ethdb.CursorDupSort).AppendDup
 				}
-			case <-ctx.Done():
-				return ctx.Err()
 			}
 		}
 	}
diff --git a/p2p/dial.go b/p2p/dial.go
index 9a879e9a89ad4af8fa0c452d8f0dcd449468176c..b4ade6f4f0a1d5a4c570b66fc37135736490dca8 100644
--- a/p2p/dial.go
+++ b/p2p/dial.go
@@ -244,6 +244,10 @@ loop:
 		d.logStats()
 
 		select {
+		case <-d.ctx.Done():
+			it.Close()
+			break loop
+
 		case node := <-nodesCh:
 			if err := d.checkDial(node); err != nil {
 				d.log.Trace("Discarding dial candidate", "id", node.ID(), "ip", node.IP(), "reason", err)
@@ -304,9 +308,6 @@ loop:
 		case <-historyExp:
 			d.expireHistory()
 
-		case <-d.ctx.Done():
-			it.Close()
-			break loop
 		}
 	}
 
diff --git a/turbo/torrent/torrent.go b/turbo/torrent/torrent.go
index 2b52d397b58a8c983ff284328aae1be6502a2bc5..c36e1ae05f06a336b039ad8dbe68348faf704ff0 100644
--- a/turbo/torrent/torrent.go
+++ b/turbo/torrent/torrent.go
@@ -85,6 +85,9 @@ func (cli *Client) AddTorrent(ctx context.Context, db ethdb.Database, snapshotNa
 	}
 
 	select {
+	case <-ctx.Done():
+		log.Warn("Init failure", "snapshot", snapshotName, "err", ctx.Err())
+		return ctx.Err()
 	case <-t.GotInfo():
 		log.Info("Init", "snapshot", snapshotName)
 		if newTorrent {
@@ -98,9 +101,6 @@ func (cli *Client) AddTorrent(ctx context.Context, db ethdb.Database, snapshotNa
 			log.Info("Loaded from db", "snapshot", snapshotName)
 		}
 
-	case <-ctx.Done():
-		log.Warn("Init failure", "snapshot", snapshotName, "err", ctx.Err())
-		return ctx.Err()
 	}
 	t.VerifyData()
 	t.DisallowDataDownload()