Fixed vine issue and added with statements to DB opening