file module should check invalid arguments (fixes #2135)

Trivial fix for #2135.