Partial work to make std.stdio.File.LockingTextWriter.put safe

This is a preliminary for the second attempt for #2225.
The objective of this pull request is to find the reason why #2225 fails on Windows systems.
Please do not merge this pull request because it may contain stub code.