Fix synchronous directory removal

Currently rimraf fails to remove a directory synchronously (i.e.
`rimraf.sync(“foo/”)`).