Improved code to fix false Note_off commands

Major improvement of note off detection that gets rid of some of
the false positives in poorly sequenced MIDIs.

Also added a -t command to allow users to fix tempo notation.
Many MIDI files produced by conversion tools like NSF2MIDI have
abnormally low tempos (30 bpm!), causing almost all of the notes
to be interpreted at 128th notes.

Using the new -t flag can fix these files, converting them to a
more meaningful tempo with more logical beat lengths.