Added missing close() invocations.