just for testing, go to IDM options and set the number of connection to 1 and see if it change the way avast re-act to malware downloads.
Since IDM separate the file to many segments to accelerate download speed, maybe avast detect malware code only to one of the those segments and break only that connection and thats where you say IDM is still downloading the file...