cleanup exit and output