Automatically remove trailing spaces and replace all tabs with spaces before writing file