app: do no overwite XCF when an error occurred at saving time.
We can cancel a file overwrite at the last second when closing the stream by setting a cancelled cancellable. Current code was simply not closing the stream, but this was not enough as overwriting was happening anyway (probably when finalizing). This will allow much safe saving process since we would not be overwriting a previously sane XCF file when an error occurred (either in our code or a memory error, or whatnot). See also discussion in #2565.
Showing with 19 additions and 6 deletions