Added fix for :
1. em.clear() on 5000
2. em.clear() and em.close() on cleanup