Reset data_source to NULL upon detaching

Prevents pointer dereference to possibly freed data source in the destructor