Close db on terminate; terminate on window close; remove unneeded synthesize