finish db thread writing