FIX: 1. mkboot output file closure issue
2. rm_links.sh does not clean all links

mkboot exits without closing output file if input file open fails.
Modified to open the output file post input file handle check and error handling.

Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>