Placement is optional but consistency isn’t. Once you decide where it goes, you should make sure it shows up in the same place both visually and in the focus order. Don’t make screen reader users have to look for it. Also keeping the OK and Cancel buttons (if that dialog has them) in the same order (i.e. one visually on the left, the other always on the right) will help all users, not just users with disabilities. Finally, make sure that your close icon container works with your visual keyboard focus indicator and that the contrast on the KFI also meets the new 2.1 minimums.
Really looking forward to your future musings on this topic !