close session upon error