Apply fix for LUCENE-5330 pruning the IndexWriter queue to get rid of pending events.

This is a workaround for LUCENE-5330 to prune the event queue on getReader()

Closes #4093