Fix write error-handling in the block manager

Currently, the block manager hangs if an error is returned from DiskIoMgr::Write().
This is because the callback is invoked in a disk thread, and Close() and
UnregisterContext() are called from the callback.
In this change:
i) The callback (WriteComplete()) has been modified to simply set a flag on error,
which also has the advantage of not occupying the disk thread with clean-up
operations
ii) Resource deallocation must be done explicitly via Close() (which is called
from SortNode::Close()). Close() is also idempotent.
iii) A RuntimeState instance is cached in the block manager for error logging.
iv) Block manager tests for the write error case.

Change-Id: I754b3203c72ac4ea98f0f48e25bf5b47bd07f17e
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2991
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins