Fixed Master so that all threads close and work properly