Added clean shutdown to DB client thread