I just added in a try catch statement that should hopefully catch any errors and keep the program from hanging.