Fixed atomicallyWriteIO so that for actions on directories it does not
crash. It is not possible to lock a directory.

For directories we directly run the operation directly instead.