file module should check invalid arguments (fixes #2135)