Handle closed in receive

Also remove erroneous thread spawn
Convert cout to log