diff --git a/autofile/autofile.go b/autofile/autofile.go
index <HASH>..<HASH> 100644
--- a/autofile/autofile.go
+++ b/autofile/autofile.go
@@ -103,6 +103,11 @@ func (af *AutoFile) Sync() error {
 	af.mtx.Lock()
 	defer af.mtx.Unlock()
 
+	if af.file == nil {
+		if err := af.openFile(); err != nil {
+			return err
+		}
+	}
 	return af.file.Sync()
 }
autofile: ensure file is open in Sync