Need to close file after end of run.

(Current implementation still causes a seg-fault).

Signed-off-by: JP-Ellis <coujellis@gmail.com>