There's a race condition happening with the ResourceManager leader election in the JobMaster while shutting it down. The JobMaster calls dissolveResourceManagerConnection while shutting down itself trying to disconnect itself from the ResourceManager (see JobMaster:1180).
This closes the RM connection to the JobMaster from the ResourceManager's side (see ResourceManager:979. The JobMaster tries to reconnect to the ResourceManager leader if there's still an address stored for that leader (which is the case during shutdown; see JobMaster:790).
The JobMaster shouldn't try to reconnect after it has already freed it's requirements as part of the shutdown.