Add decorator for opening files.