Ensuring the file gets closed.