Only explicitly lock files on non-Windows platforms. Windows always locks when the file is opened, and the explicit lock results in a subsequent exception.