                                  &format,
                                  .eraseFile,
                                  &backwardAudioFile)
-//    IF_ERR_RETURN
+    if err != noErr { return err }
 
     // prepare to read buffers of audio from the forward file
     let transferBufferPacketCount: UInt32  = 0x2000

                                        outputFilePacketPosition,
                                        &frameCount,
                                        buffer.mData!)
//            IF_ERR_GOTO_CLEANUP_1
            outputFilePacketPosition += Int64(frameCount)
        }
        
    }
    
//    cleanup1:
    
    free(outputBuffer)
    ExtAudioFileDispose(sourceExtAudioFile!)
    AudioFileClose(forwardAudioFile!)
//    IF_ERR_RETURN
    
    // open the forward file for reading
    err = AudioFileOpenURL(forwardURL,
                           .readPermission,
                           kAudioFileCAFType,
                           &forwardAudioFile)
//    IF_ERR_RETURN

    // open the backward file for writing
    var backwardAudioFile: AudioFileID? = nil

                                      inputPacketPosition,
                                      &packetsToTransfer,
                                      transferBuffer);
        if err != noErr {
            cleanup2(transferBuffer: transferBuffer, swapBuffer: swapBuffer, forwardAudioFile: forwardAudioFile, backwardAudioFile: backwardAudioFile)
            return err
        }
        
        if packetsToTransfer == 0 {
            break
        }
