Writes a custom sized binary unsigned integer value to the file. This method returns a negative value if it fails.