Don't write the key file if there is no data.

The default-client.pem file is being immediately overwritten by a 0 byte file in my environment.  I'm still not sure why this block gets executed multiple times, but I've been using this patch to prevent it from happening.