altered to remove from registry before terminating session (in WAS, session.invalidate does not work)