GCS MapLib, fix database disconnection upon creation

This caused the database to be disconnected if no DB file was found and needed to be created.
From Qt docs all queries need to be destroyed before calling removeDatabase.
This change makes sure all queries are out of scope when calling removeDatabase.

This diff looks like lots of changes were made but in reality only  "{" was added to line 72 and "}" to line 169, all other changes were due to indentation changes.