fix ending
Merge pull request #2 from mafintosh/patch-2

call callback in flush