diff --git a/audio/ulaw/ulaw.go b/audio/ulaw/ulaw.go
index <HASH>..<HASH> 100644
--- a/audio/ulaw/ulaw.go
+++ b/audio/ulaw/ulaw.go
@@ -19,8 +19,12 @@ func WriteFileWavFromUlaw(filename string, ulawBytes []byte) error {
 	if err != nil {
 		return err
 	}
+	defer f.Close()
 	_, err = WriteWavFromUlaw(f, ulawBytes)
-	return err
+	if err != nil {
+		return err
+	}
+	return f.Sync()
 }
 
 func WriteWavFromUlaw(w io.Writer, ulawBytes []byte) (n int, err error) {
enhance: audio/ulaw: update file close