Fix unmatched returns dialyzer warnings

Fixes unmatched returns dialyzer warnings from #2478.

Generated erlang issues:
* There are still warnings for `for` comprehensions when matched against an empty variable.
* Unmatched returns for `cond` expressions report the wrong line (the line of the first clause).
It was `File.rm(beam)` because if someone manually removed a compile artefact from beam, it should not crash everything.