Scanning the "created/modified" files is scanning "on close" - the file is scanned after it is written and closed, so the file is already there. It is not possible to deny "writing to a file".
Scanning the file "on open", however, is performed before the file is actually opened; and if the file is found infected, the opening is denied. So, the fact that you got two messages does not mean that the second one infected you.
In fact, I'm not even sure that the first one was done "on write", the second "on open".
However, I can't explain why you got the warnings at all... it shouldn't happen. First, the temporary file should not be kept in the temp dir, second - avast! shouldn't warn you about its own access to the infected file. So... some other program may have accessed it?
What was the virus name?