--- Quote Start ---
I know modelsim does not like free running binary counters. so just put a constraint at last count.
if count = 2**12-1 then
count <= (others => '0');
else...
--- Quote End ---
There is nothing wrong with the origional code. Because the type is unsigned it will wrap around to 0 when it reaches 2**12-1. You only need to check for max if you are using an integer type.
The error is something to do with modelsim not having permission to delete some file. Not with the VHDL.
As an asside, the counter wont work unless it is reset or given some initial value.