Fix closing conn on bad resource