Added code for writing the output pcap.