Add proper error handling. Summary:

Summary: Add error handling when create_new() tries to  write to a location it does not have permission to.

Test Plan: no test plan

Reviewers: cprodescu

Differential Revision: http://phab.code4fun.de/D35
Fix segfault