add cleanup code when exception is encountered