Fixes #611

This fixes every single issue I've saw while updating or installing 1.8 with all supported databases. This fixes also some errors in the frontend as I've added `closeCursor` nearly everywhere.

PS: we should drop SQLite support -.- :P