added delete for documents and fixed case close