I understand it's all your code, but if you wrote that code, you should understand my reply...
Add a before line 103. To see if that's the cause of your connection still in use, as well as fix the memory leak below...
You also allocate your connection and query objects on the heap ("new" keyword) but you don't free that memory anywhere, so you should just allocate them on the stack and they'll go out of scope at the end of your loadData() method or make them class variables where they can be used in other parts of your code if needed.
Bookmarks