fixed committing and closing error handling
modify testing case