Fix dex location filtering in dex2oat

Previously we were filtering dex location against profile keys,
this meant qualified ones like /system/.../app.apk would not match
the profile key app.apk in the profile. This CL fixes changes the
behavior to filter based on the profile key of the dex file location.

Fixed OatWriter checksum for raw data case (also found by regression
test).

Added missing FlushCloseOutputFiles to CompileImage causing DCHECK
failures for File destructor.

All the fixes are regression tested by dex2oat_test.

Test: test-art-host-gtest-dex2oat_test

Bug: 34929159
Bug: 35761072

Change-Id: I1bdc949bd644bfab1c8fea0b737a132b487a653b
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 33eed3c..a5d26c7 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -617,7 +617,8 @@
   std::set<DexCacheResolvedClasses> GetResolvedClasses(bool ignore_boot_classes)
       REQUIRES(!Locks::dex_lock_);
 
-  std::unordered_set<std::string> GetClassDescriptorsForProfileKeys(
+  // Returns the class descriptors for loaded dex files.
+  std::unordered_set<std::string> GetClassDescriptorsForResolvedClasses(
       const std::set<DexCacheResolvedClasses>& classes)
       REQUIRES(!Locks::dex_lock_);