Added lock when calling doc.Delete() for when signals have no sender (#350)