Write to temp file when signing apps (bug 875535)
Also fix broken signed apps upon re-signing.