fixed so that closing the drawing window does not exit the program