ImageWriter: Exception when Surface is abandoned

Throw IllegalStateException when queueing or dequeueing an
image if the input surface is already abandoned by the consumer.

Also fix a crash when planes are not initialized when closing
ImageWriter.

Bug: 22279111
Change-Id: I8301920d64a53c45b29e947e52ff323733abbf16
3 files changed