added database close on.exit