Fix buggy finalization behavior

Finalizers are forgotten under certain circumstances, and pipes with finalizers are not associative. I've provided a solution that solves both of these issues by adding a finalizer to the `Done` constructor. I updated everywhere that pattern matched on the Done constructor, triggering the finalization where appropriate.

I've included a file with simple test cases; the current implementation fails two of the three, while the proposed change passes all three.