The key generation mongos_does_not_gossip_logical_time_without_keys.js is disabled only on primary
https://github.com/mongodb/mongo/blob/master/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js#L37-L38
the logs show that sometimes the secondary becomes the primary and generates the keys when test is being shut down.
Need to also disable key generation on secondary