Solved multithreading issue sqlite database