Fix proc_open resource destruction