Ensure autopickup_rules, msgtype option, binary header are fully written

This covers the last few unchecked write() calls in log.c to ensure all
the data passed is fully written.  Goodbye log corruption, you will not
be missed.

This is meant to go with commit ae125d1c44 (add MSGTYPE option), commit
a5bc53bb3a (autopickup rules) and commit 86bb075297 (NH4: store game
state diffs in logs and saves).
Bump patchlevel to 0.5.2

This release greatly increases save file integrity and ability to
recover by fixing cases of incomplete data being logged that were
overlooked by NitroHack and NetHack4.

This version is save-compatible with v0.5.0 and v0.5.1, and players of
these versions are urged to update.  Save files for games that fail to
recover automatically can be sent to tungtn3+dynahack@gmail.com for
manual recovery.