Use AVFrame locally instead of instance-wide.
Use a property for closed attribute.
Let __dealloc__ do the cleanup in case of error.