Even better emulate POSIX file functions (reduced)

This is reduced version of #5694.
Only obvious fixes.
PosixFile a small, but noticeable example.