Add c.close to end connections gracefully