Writing file to local storage