Added Synchronization block to avoid Race condition

While removing the top activities of crashed process from the
history stack sometimes it was leading to race condition and decrementing
history stack index twice. because of this index out of bound issue was coming

Change-Id: I2a5667d36aaa7c3b7adac347db6c9bc7429d9444
CRs-fixed: 381904