diff --git a/docs/storage/layerwriter.go b/docs/storage/layerwriter.go
index <HASH>..<HASH> 100644
--- a/docs/storage/layerwriter.go
+++ b/docs/storage/layerwriter.go
@@ -109,6 +109,10 @@ func (lw *layerWriter) ReadFrom(r io.Reader) (n int64, err error) {
 }
 
 func (lw *layerWriter) Close() error {
+	if lw.err != nil {
+		return lw.err
+	}
+
 	if err := lw.storeHashState(); err != nil {
 		return err
 	}
Prevent Close() from being called after Finish()