Finally fixed bug by closing database.
Finally fixed bug by closing database.