fix opening connection when closed