Issue #67: Ensure that the sockets are closed at device free
Cosmetics: Fix some indent inconsistencies