Avast is installed by default in persistent mode. To quit the application you must disable it. Go to preferences and uncheck "Launch at startup as a persistent application" you should then be able to close avast.
A better option though is just to hide it and let it scan in the background. you can hide the program by pressing Command + H (Command key is the apple key)