Added missing errors on write functions

Added a direct to file write function