Cleaning up pool and wrapping exceptions in "end"

Addresses #903