Adding callback for timeout,error and close

Signed-off-by: Vivek Goel <goelvivek2011@gmail.com>