Try restarting and opening iMovie while holding down the Option and Command keys and selecting to delete preferences in the box that appears. iMovie will open in a new library. Reopen your old library to get back to your projects. See if the conversion process now works without hanging up. If you can, try launching the conversion process by selecting your Library in the My Media sidebar and doing File/Check Media for Compatibility.
If the conversion still hangs up on a particular .avi file, possibly that file is corrupted in some way. You can try removing the file by selecting your Library in the My Media sidebar and doing a search for the file by typing in its name into the little search box marked by Q located immediately above the My Media browser display screen. (Or maybe you know where the file is located.)
If you can find the file, do a File/Reveal in Finder on it and drag it onto your desktop from the Original Media Folder that pops up. That will remove the file from the iMovie library and any projects that might be referencing it. Now try the media conversion process and see if it works. If it doesn't work, put the file back where you found it.
As a further note, it just may be that you have to wait a little longer for the conversion to take place. Also, "cancelling background tasks" can sometimes take a couple of minutes.
-- Rich