I recently created a new user account to solve other problems I was having, based on your advice. Since then, every time multiple windows or pop up windows are open in Safari and I try to close one, the browser quits. In case it's relevant, I moved my old keychain folder to the new account when I created it, and now every time I open the Mail app after logging on it asks me to type in my old keychain.