fixed a ton of bugs implemented cache close #12