use closeLog to cut down on code duplication