Fix file descriptor issue.

See here: https://twitter.com/apeiros/status/476460445852008448