modify close logic on non-persistent connection