finish check-out function