Fix directory creation to save threads to files