fix: no longer extra data when writing out to larger file

Previously when a file was edited to be smaller than it was when it was
opened, the difference would be leftover in the newly written file. With
this patch, that difference is deleted, writing whatever is in the
buffer directly to the file.

Signed-off-by: Ricky Ayoub <vgmoose@gmail.com>