FIX: mkboot output file closure and link deletion in rm_links.sh issues

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>