How to handle master changed during mongorestore?
Yes and no. You need to check from log file, why primary status was moved to other node, because it's not happened without reason.

You can always change your rs.conf() so, one node have higher priority than other, so it stays primary as long as it can. 

But in this situation you still need to check from mongod.log file reason why replica sets nodes voted that move primary status was necessary.