Got the answer myself:
if ($data['document'] == null)
{
unset($data['document']);
}
if nothing is added to the form while editing it. You only have to check if the array is null or not. If $data['document'] == null then you have to unset this $data['document'] so it will not be replaced with null and the old files will still be