Also sort bap habitats by determination quality

Also sort bap habitats by determination quality.
Fix active layer being closed after export

Fix active layer being closed after export and force modal dialogs to
have main interface as parent/owner.