Close open file descriptor and some simple API calls.