         err = ExtAudioFileRead(sourceExtAudioFile!,
                                &packetsPerBuffer,
                                &convertedData)
-//        IF_ERR_GOTO_CLEANUP_1
+        if err != noErr {
+            cleanup1(outputBuffer: outputBuffer, sourceExtAudioFile: sourceExtAudioFile, forwardAudioFile: forwardAudioFile)
+            return err
+        }
 
         if (frameCount == 0) {
             print("done reading file")

    }
    
//    cleanup2:
    free(transferBuffer)
    free(swapBuffer)
    AudioFileClose(forwardAudioFile!)
    AudioFileClose(backwardAudioFile!)

    
    return err
}

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

        // log that we're actually working, every 1KB.
        if (packetsProcessed % 0x1000 == 0) {
