Fix crash when a download is interrupted

Change-Id: I83fdd3203c12612a369e182b35ce82b38b1ec020