Avoid potential NPE by doing mass cleaning when session gets closed