Fix to raise Device_Error on opening or closing a file