Remove temporary file on hash mismatch (fixes #771)