Remove trailing whitespace
Check keyword arguments in Writer constructor and add unit test