fix dbWriteStream not ending