Allow applications to send additional close codes

Closes #98