being more careful with closing open file descriptors
added some cases where we shutdown peers