End session on buffer close

it's not configurable though :)