diff --git a/scapy/utils.py b/scapy/utils.py
index <HASH>..<HASH> 100644
--- a/scapy/utils.py
+++ b/scapy/utils.py
@@ -714,6 +714,7 @@ class RawPcapWriter:
                 try:
                     p = pkt.next()
                 except StopIteration:
+                    self._write_header("")
                     return
                 self._write_header(p)
                 self._write_packet(p)
wrpcap() creates a valid PCAP file when called with an empty list

--HG--
branch : issue-<I>