Apache2 configuration error: "<VirtualHost> was not closed" error

I had the same problem in my virtualHosts config and solved it by converting Windows format file to Unix format file.

All characters "\r" (CR carriage return) need to be converted in "\n" unix (LF line feed)