file_write: Fix NULL pointer dereference.