Remove temporary files on exit or cancel

Fixes #127.