clear sessions (rebased onto dev_5_0)


This is the same as gh-2686 but rebased onto dev_5_0.

----

This should cover the answer in http://lists.openmicroscopy.org.uk/pipermail/ome-users/2014-June/004528.html

Documented in https://github.com/openmicroscopy/ome-documentation/pull/855