Stop writing pulses to file directly which was causing two pulses to be
saved.  Partially solves issue #66.