Fixes an error when attempting to write to a non-existent directory