Fix checkwrite for csh.
Merge pull request #4175 from AndresTanasijczuk/checkwrite_csh

Fix checkwrite for csh.