Revert "Fixes various resource leak issues."

This reverts commit 30fc1ae089409c62c30443e6988287658f96f840.
fixed OS error where we were closing a connection someone else was using.
fixed OS error where we were closing a connection someone else was using.