Fix for crash when deleting an object from multiple threads

@tgoyne 

Hopefully fixes #1095