added try/catch to closeAlert