More refactoring to FileStream.

Also, permission for automatically created folders when opening the stream has changed from 0777 to 0775