Give a friendlier error message for EPERM when writing socket

Fixes #127.