Previously, when saving a temporary project, two native dialogs would be
created. The first was very short-lived, as it was automatically
dismissed by the second dialog. On older macOS versions, this appeared
to work correctly (the first dialog was so short-lived that it did not
appear to the user). However, on macOS 12.0, the second dialog fails to
display altogether.
Displaying two file chooser dialogs feels like a programming error, so
the code has been reorganised a bit to avoid this case.