writes a binary file