Updates term when receiving append entries message.