let attr handle closing sessions

and fix a test