Move av_exit() to before main()