Use socket.makefile instead of open.

They seem to behave the same, but at least the former does not throw OSErrors.
Redesign error pages.