Fixed mistake in finding the local directory of the open file.