Added method to close the file descriptor.

A quick patch to add a close method. Without this, the file descriptor can't be closed without exiting your app.