I think what you might want is to set expiration to 0. I haven't tried it though. That sets the cookie expiration to now which I believe makes it a "session" cookie which expires when the browser is quit.
Try setting one or both of these to 0: settings.expiration = 3600 # one hour settings.long_expiration = 3600*30*24 # one month