Make sure to close file handle and such