Fix thread safety for database cursor

The database cursor is not thread save. That's why uploading
multiple tracks at once sometimes failed.

Fixes #2
Fixes #3

Reported-By: cleanerx <cleanerx@hotmail.de>