Added error handling to 50-file.js

Handles 'file not found' and other errors gracefully; the current setup kills the flow and leaves the client hanging if any problems are encountered.