avcodec/vaapi_encode: Fix segfault upon closing uninitialized encoder