Added teardown logic to remove temp files, made error message more specific