Close receiver properly
Use quiet closing for connections too
Collapse an if-else into a ternary