Fix test_data_layer segfault by adding destructor to join pthread