Fixed incorrect EOF handling in MemBio, added error description

Actually, EOF wasn't handled at all and it caused `mem_bio.read_to_end()` to fail. Which in turn failed all `write_pem` implementations.