added commitAndClose, rollbackAndClose methods