lavf/mux: Always call write_trailer() from av_write_trailer() to avoid a leak.

Fixes ticket #4049.
Merge remote-tracking branch 'cehoyos/master'

* cehoyos/master:
  lavf/mux: Always call write_trailer() from av_write_trailer() to avoid a leak.

Merged-by: Michael Niedermayer <michaelni@gmx.at>