[qtdeclarative] Fix crash on QQmlEngine destruction.

QQmlTypeLoader references QQmlImportDatabase in a thread, so change the
declaration order so QQmlTypeLoader is destroyed and its thread stopped
before QQmlImportDatabase is destroyed.