added forgotten commit() and close()