The stacktrace says it all.

System.Runtime.InteropServices.COMException (0x80070000): The operation
completed successfully. (Exception from HRESULT: 0x80070000)
at MS.Internal.HRESULT.Check(Int32 hr)
at System.Windows.Media.SafeProfileHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
at System.Runtime.InteropServices.SafeHandle.Finalize()

My guess on why we get "The operation completed successfully" is
SetLastError wasn't set on the DllImport for CloseColorProfile. So by the
time Marshal.GetHRForLastWin32Error() is called the error has been cleared by
some marshalling code.

We had temporarily got around this by calling GC.WaitForPendingFinalizers()
but then later found out that is a big no no in the WPF as some finalizers
call Dispatcher.Invoke which at that point would deadlock the application.

We are thinking about just using BitmapCreateOptions.IgnoreColorProfile
since without an error message this is hard to figure out.