Check deferred closes for errors. Additional error handling.