YARN-2432. RMStateStore should process the pending events before close. Contributed by Varun Saxena
(cherry picked from commit 9b860661a5754e829bd8c34ef092757421589bbe)