Updated to not leak file descriptors for invalid sites