Eliminate trailing data on close. Fixes #21.