adding callback for timeout,close and error