added try catch block around socket shutdown command