Fix optimize command and view resolver for unknown extensions. Fixes #4688

https://github.com/laravel/framework/issues/4688

Took the liberty of fixing it since I introduced the feature. Thanks to @crynobone for reporting it