Fixed file descriptor leaking introduced in [b4fa45b6aa] and made connection re-use more clean