Currently, we use assert.soon to poll the secondary using replSetGetStatus to check if the node recognizes that it has been removed via heartbeat reconfig. The test then moves on by issuing commands on the removed secondary. However, it is possible that we poll at this exact moment where the secondary has updated its replSetStatus response and drops its lock, and in that case, it is posslble we start issuing commands on the node when it starts to close all connections as part of transitioning to REMOVED. This causes network errors to happen sporadically in our patch builds in this specific part of the test.
I think ideally, we want to wait for the connections to finish closing before we start issuing commands. We can do this by adding a failpoint.