added try catch around disconnect