Fix write's locking; add rmdir, unlink