@Override
    public void close() throws IOException {
        if (closed)
            return;
        closed = true;
        if (os != null) {
            os.close();
            File lastPart = getFile(filesCreated);
            if (lastPart.length() == 0) {
                if (!lastPart.delete()) {
                    LogFactory.getLog(getClass()).debug(
                            "Ignoring failure to delete empty file " + lastPart);
                }
            } else {
                // notify about the new file ready for processing
                observer.onPartCreate(new PartCreationEvent(
                        getFile(filesCreated), filesCreated, true, this));
            }
        }
    }
Blocks the running thread if running out of disk space.

@throws AbortedException
            if the running thread is interrupted while acquiring a
            semaphore
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/MultiFileOutputStream.java